Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: map_cell_index_static produced wrong results when the number of elements per cell was a power of 2 #4651

Merged
merged 4 commits into from
Jan 5, 2025

Conversation

flga
Copy link
Contributor

@flga flga commented Jan 3, 2025

package main

import "base:runtime"
import "core:fmt"

main :: proc() {
	m := map[int][3]int{
		1 = {10, 20, 30},
		2 = {40, 50, 60},
		3 = {70, 80, 90},
	}

	fmt.println(runtime.map_get(m, 1))
	fmt.println(runtime.map_get(m, 2))
	fmt.println(runtime.map_get(m, 3))
}

prints

0 [0, 0, 0] false
0 [0, 0, 0] false
0 [0, 0, 0] false

instead of

1 [10, 20, 30] true
2 [40, 50, 60] true
3 [70, 80, 90] true 

@flga flga marked this pull request as draft January 3, 2025 16:17
@flga flga marked this pull request as ready for review January 3, 2025 17:03
@laytan laytan merged commit bf77036 into odin-lang:master Jan 5, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants