diff options
| author | gingerBill <bill@gingerbill.org> | 2022-04-04 17:04:12 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-04-04 17:04:12 +0100 |
| commit | 59025b75ba885d0efb6475608a217083bfb1d63e (patch) | |
| tree | 8b9c633e58ace522fb4545bb646b8556f7b725c8 /core/strings/ascii_set.odin | |
| parent | 2289b7a33de6e265a8d0c4c497a2afa4c2b140e2 (diff) | |
| parent | 79ec1727975cb8d4def23635ae62ff4b0540230d (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odindev-2022-04
Diffstat (limited to 'core/strings/ascii_set.odin')
| -rw-r--r-- | core/strings/ascii_set.odin | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/strings/ascii_set.odin b/core/strings/ascii_set.odin index 582049eee..9b59666f3 100644 --- a/core/strings/ascii_set.odin +++ b/core/strings/ascii_set.odin @@ -5,6 +5,7 @@ import "core:unicode/utf8" Ascii_Set :: distinct [8]u32 +// create an ascii set of all unique characters in the string ascii_set_make :: proc(chars: string) -> (as: Ascii_Set, ok: bool) #no_bounds_check { for i in 0..<len(chars) { c := chars[i] @@ -17,6 +18,7 @@ ascii_set_make :: proc(chars: string) -> (as: Ascii_Set, ok: bool) #no_bounds_ch return } +// returns true when the `c` byte is contained in the `as` ascii set ascii_set_contains :: proc(as: Ascii_Set, c: byte) -> bool #no_bounds_check { return as[c>>5] & (1<<(c&31)) != 0 }
\ No newline at end of file |