mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
More style improvements
This commit is contained in:
@@ -70,8 +70,7 @@ set :: proc(c: ^$C/Cache($Key, $Value), key: Key, value: Value) -> runtime.Alloc
|
||||
if c.count == c.capacity {
|
||||
e = c.tail
|
||||
_remove_node(c, e)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
c.count += 1
|
||||
e = new(Node(Key, Value), c.node_allocator) or_return
|
||||
}
|
||||
|
||||
@@ -897,19 +897,20 @@ XXH3_hashLong_64b_default :: #force_no_inline proc(input: []u8, seed64: xxh_u64,
|
||||
why (uop cache maybe?), but the difference is large and easily measurable.
|
||||
*/
|
||||
@(optimization_mode="speed")
|
||||
XXH3_hashLong_64b_withSeed_internal :: #force_no_inline proc(input: []u8,
|
||||
seed: xxh_u64,
|
||||
f_acc512: XXH3_accumulate_512_f,
|
||||
f_scramble: XXH3_scramble_accumulator_f,
|
||||
f_init_sec: XXH3_init_custom_secret_f) -> (hash: xxh_u64) {
|
||||
XXH3_hashLong_64b_withSeed_internal :: #force_no_inline proc(
|
||||
input: []u8,
|
||||
seed: xxh_u64,
|
||||
f_acc512: XXH3_accumulate_512_f,
|
||||
f_scramble: XXH3_scramble_accumulator_f,
|
||||
f_init_sec: XXH3_init_custom_secret_f,
|
||||
) -> (hash: xxh_u64) {
|
||||
if seed == 0 {
|
||||
return XXH3_hashLong_64b_internal(input, XXH3_kSecret[:], f_acc512, f_scramble)
|
||||
}
|
||||
{
|
||||
secret: [XXH_SECRET_DEFAULT_SIZE]u8
|
||||
f_init_sec(secret[:], seed)
|
||||
return XXH3_hashLong_64b_internal(input, secret[:], f_acc512, f_scramble)
|
||||
}
|
||||
|
||||
secret: [XXH_SECRET_DEFAULT_SIZE]u8
|
||||
f_init_sec(secret[:], seed)
|
||||
return XXH3_hashLong_64b_internal(input, secret[:], f_acc512, f_scramble)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -655,7 +655,7 @@ choice_enum :: proc($T: typeid) -> T
|
||||
where
|
||||
intrinsics.type_is_enum(T),
|
||||
size_of(T) <= 8,
|
||||
len(T) == cap(T) /* Only allow contiguous enum types */
|
||||
len(T) == cap(T) /* Only allow contiguous enum types */ \
|
||||
{
|
||||
when intrinsics.type_is_unsigned(intrinsics.type_core_type(T)) &&
|
||||
u64(max(T)) > u64(max(i64)) {
|
||||
|
||||
@@ -156,8 +156,7 @@ linear_search_proc :: proc(array: $A/[]$T, f: proc(T) -> bool) -> (index: int, f
|
||||
*/
|
||||
@(require_results)
|
||||
binary_search :: proc(array: $A/[]$T, key: T) -> (index: int, found: bool)
|
||||
where intrinsics.type_is_ordered(T) #no_bounds_check
|
||||
{
|
||||
where intrinsics.type_is_ordered(T) #no_bounds_check {
|
||||
return binary_search_by(array, key, cmp_proc(T))
|
||||
}
|
||||
|
||||
|
||||
@@ -240,8 +240,7 @@ decode_grapheme_clusters :: proc(
|
||||
// GB8: (LVT | T) × T
|
||||
if is_hangul_syllable_leading(this_rune) ||
|
||||
is_hangul_syllable_lv(this_rune) ||
|
||||
is_hangul_syllable_lvt(this_rune)
|
||||
{
|
||||
is_hangul_syllable_lvt(this_rune) {
|
||||
if !is_hangul_syllable_leading(last_rune) {
|
||||
grapheme_count += 1
|
||||
}
|
||||
@@ -251,8 +250,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_hangul_syllable_vowel(this_rune) {
|
||||
if is_hangul_syllable_leading(last_rune) ||
|
||||
is_hangul_syllable_vowel(last_rune) ||
|
||||
is_hangul_syllable_lv(last_rune)
|
||||
{
|
||||
is_hangul_syllable_lv(last_rune) {
|
||||
continue
|
||||
}
|
||||
grapheme_count += 1
|
||||
@@ -263,8 +261,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_hangul_syllable_trailing(last_rune) ||
|
||||
is_hangul_syllable_lvt(last_rune) ||
|
||||
is_hangul_syllable_lv(last_rune) ||
|
||||
is_hangul_syllable_vowel(last_rune)
|
||||
{
|
||||
is_hangul_syllable_vowel(last_rune) {
|
||||
continue
|
||||
}
|
||||
grapheme_count += 1
|
||||
@@ -285,8 +282,7 @@ decode_grapheme_clusters :: proc(
|
||||
if current_sequence == .Indic {
|
||||
if is_indic_conjunct_break_extend(this_rune) && (
|
||||
is_indic_conjunct_break_linker(last_rune) ||
|
||||
is_indic_conjunct_break_consonant(last_rune) )
|
||||
{
|
||||
is_indic_conjunct_break_consonant(last_rune) ) {
|
||||
continue_sequence = true
|
||||
continue
|
||||
}
|
||||
@@ -294,8 +290,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_indic_conjunct_break_linker(this_rune) && (
|
||||
is_indic_conjunct_break_linker(last_rune) ||
|
||||
is_indic_conjunct_break_extend(last_rune) ||
|
||||
is_indic_conjunct_break_consonant(last_rune) )
|
||||
{
|
||||
is_indic_conjunct_break_consonant(last_rune) ) {
|
||||
continue_sequence = true
|
||||
continue
|
||||
}
|
||||
@@ -306,8 +301,7 @@ decode_grapheme_clusters :: proc(
|
||||
// (Support for GB11.)
|
||||
if current_sequence == .Emoji && (
|
||||
is_gcb_extend_class(last_rune) ||
|
||||
is_emoji_extended_pictographic(last_rune) )
|
||||
{
|
||||
is_emoji_extended_pictographic(last_rune) ) {
|
||||
continue_sequence = true
|
||||
}
|
||||
|
||||
@@ -336,8 +330,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_indic_conjunct_break_consonant(this_rune) {
|
||||
if current_sequence == .Indic {
|
||||
if last_rune == ZERO_WIDTH_JOINER ||
|
||||
is_indic_conjunct_break_linker(last_rune)
|
||||
{
|
||||
is_indic_conjunct_break_linker(last_rune) {
|
||||
continue_sequence = true
|
||||
} else {
|
||||
grapheme_count += 1
|
||||
@@ -353,8 +346,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_indic_conjunct_break_extend(this_rune) {
|
||||
if current_sequence == .Indic {
|
||||
if is_indic_conjunct_break_consonant(last_rune) ||
|
||||
is_indic_conjunct_break_linker(last_rune)
|
||||
{
|
||||
is_indic_conjunct_break_linker(last_rune) {
|
||||
continue_sequence = true
|
||||
} else {
|
||||
grapheme_count += 1
|
||||
@@ -366,8 +358,7 @@ decode_grapheme_clusters :: proc(
|
||||
if is_indic_conjunct_break_linker(this_rune) {
|
||||
if current_sequence == .Indic {
|
||||
if is_indic_conjunct_break_extend(last_rune) ||
|
||||
is_indic_conjunct_break_linker(last_rune)
|
||||
{
|
||||
is_indic_conjunct_break_linker(last_rune) {
|
||||
continue_sequence = true
|
||||
} else {
|
||||
grapheme_count += 1
|
||||
|
||||
Reference in New Issue
Block a user