diff options
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/code/demo.odin b/code/demo.odin index 9a4db13cc..b1d1e1490 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -338,7 +338,7 @@ union_type :: proc() { parametric_polymorphism :: proc() { print_value :: proc(value: $T) { - fmt.printf("print_value: %v %v\n", value, value); + fmt.printf("print_value: %T %v\n", value, value); } v1: int = 1; @@ -496,10 +496,12 @@ parametric_polymorphism :: proc() { return -1; } - get_hash :: proc(s: string) -> u32 { // djb2 - hash: u32 = 0x1505; - for i in 0..len(s) do hash = (hash<<5) + hash + u32(s[i]); - return hash; + get_hash :: proc(s: string) -> u32 { // fnv32a + h: u32 = 0x811c9dc5; + for i in 0..len(s) { + h = (h ~ u32(s[i])) * 0x01000193; + } + return h; } @@ -586,6 +588,7 @@ threading_example :: proc() { main :: proc() { +when false { if true { fmt.println("\ngeneral_stuff:"); general_stuff(); fmt.println("\nnested_struct_declarations:"); nested_struct_declarations(); @@ -595,4 +598,5 @@ main :: proc() { } fmt.println("\nthreading_example:"); threading_example(); } +} |