mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +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 {
|
if c.count == c.capacity {
|
||||||
e = c.tail
|
e = c.tail
|
||||||
_remove_node(c, e)
|
_remove_node(c, e)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
c.count += 1
|
c.count += 1
|
||||||
e = new(Node(Key, Value), c.node_allocator) or_return
|
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.
|
why (uop cache maybe?), but the difference is large and easily measurable.
|
||||||
*/
|
*/
|
||||||
@(optimization_mode="speed")
|
@(optimization_mode="speed")
|
||||||
XXH3_hashLong_64b_withSeed_internal :: #force_no_inline proc(input: []u8,
|
XXH3_hashLong_64b_withSeed_internal :: #force_no_inline proc(
|
||||||
seed: xxh_u64,
|
input: []u8,
|
||||||
f_acc512: XXH3_accumulate_512_f,
|
seed: xxh_u64,
|
||||||
f_scramble: XXH3_scramble_accumulator_f,
|
f_acc512: XXH3_accumulate_512_f,
|
||||||
f_init_sec: XXH3_init_custom_secret_f) -> (hash: xxh_u64) {
|
f_scramble: XXH3_scramble_accumulator_f,
|
||||||
|
f_init_sec: XXH3_init_custom_secret_f,
|
||||||
|
) -> (hash: xxh_u64) {
|
||||||
if seed == 0 {
|
if seed == 0 {
|
||||||
return XXH3_hashLong_64b_internal(input, XXH3_kSecret[:], f_acc512, f_scramble)
|
return XXH3_hashLong_64b_internal(input, XXH3_kSecret[:], f_acc512, f_scramble)
|
||||||
}
|
}
|
||||||
{
|
|
||||||
secret: [XXH_SECRET_DEFAULT_SIZE]u8
|
secret: [XXH_SECRET_DEFAULT_SIZE]u8
|
||||||
f_init_sec(secret[:], seed)
|
f_init_sec(secret[:], seed)
|
||||||
return XXH3_hashLong_64b_internal(input, secret[:], f_acc512, f_scramble)
|
return XXH3_hashLong_64b_internal(input, secret[:], f_acc512, f_scramble)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ choice_enum :: proc($T: typeid) -> T
|
|||||||
where
|
where
|
||||||
intrinsics.type_is_enum(T),
|
intrinsics.type_is_enum(T),
|
||||||
size_of(T) <= 8,
|
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)) &&
|
when intrinsics.type_is_unsigned(intrinsics.type_core_type(T)) &&
|
||||||
u64(max(T)) > u64(max(i64)) {
|
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)
|
@(require_results)
|
||||||
binary_search :: proc(array: $A/[]$T, key: T) -> (index: int, found: bool)
|
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))
|
return binary_search_by(array, key, cmp_proc(T))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,8 +240,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
// GB8: (LVT | T) × T
|
// GB8: (LVT | T) × T
|
||||||
if is_hangul_syllable_leading(this_rune) ||
|
if is_hangul_syllable_leading(this_rune) ||
|
||||||
is_hangul_syllable_lv(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) {
|
if !is_hangul_syllable_leading(last_rune) {
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
}
|
}
|
||||||
@@ -251,8 +250,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_hangul_syllable_vowel(this_rune) {
|
if is_hangul_syllable_vowel(this_rune) {
|
||||||
if is_hangul_syllable_leading(last_rune) ||
|
if is_hangul_syllable_leading(last_rune) ||
|
||||||
is_hangul_syllable_vowel(last_rune) ||
|
is_hangul_syllable_vowel(last_rune) ||
|
||||||
is_hangul_syllable_lv(last_rune)
|
is_hangul_syllable_lv(last_rune) {
|
||||||
{
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
@@ -263,8 +261,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_hangul_syllable_trailing(last_rune) ||
|
if is_hangul_syllable_trailing(last_rune) ||
|
||||||
is_hangul_syllable_lvt(last_rune) ||
|
is_hangul_syllable_lvt(last_rune) ||
|
||||||
is_hangul_syllable_lv(last_rune) ||
|
is_hangul_syllable_lv(last_rune) ||
|
||||||
is_hangul_syllable_vowel(last_rune)
|
is_hangul_syllable_vowel(last_rune) {
|
||||||
{
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
@@ -285,8 +282,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if current_sequence == .Indic {
|
if current_sequence == .Indic {
|
||||||
if is_indic_conjunct_break_extend(this_rune) && (
|
if is_indic_conjunct_break_extend(this_rune) && (
|
||||||
is_indic_conjunct_break_linker(last_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_sequence = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -294,8 +290,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_indic_conjunct_break_linker(this_rune) && (
|
if is_indic_conjunct_break_linker(this_rune) && (
|
||||||
is_indic_conjunct_break_linker(last_rune) ||
|
is_indic_conjunct_break_linker(last_rune) ||
|
||||||
is_indic_conjunct_break_extend(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_sequence = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -306,8 +301,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
// (Support for GB11.)
|
// (Support for GB11.)
|
||||||
if current_sequence == .Emoji && (
|
if current_sequence == .Emoji && (
|
||||||
is_gcb_extend_class(last_rune) ||
|
is_gcb_extend_class(last_rune) ||
|
||||||
is_emoji_extended_pictographic(last_rune) )
|
is_emoji_extended_pictographic(last_rune) ) {
|
||||||
{
|
|
||||||
continue_sequence = true
|
continue_sequence = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,8 +330,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_indic_conjunct_break_consonant(this_rune) {
|
if is_indic_conjunct_break_consonant(this_rune) {
|
||||||
if current_sequence == .Indic {
|
if current_sequence == .Indic {
|
||||||
if last_rune == ZERO_WIDTH_JOINER ||
|
if last_rune == ZERO_WIDTH_JOINER ||
|
||||||
is_indic_conjunct_break_linker(last_rune)
|
is_indic_conjunct_break_linker(last_rune) {
|
||||||
{
|
|
||||||
continue_sequence = true
|
continue_sequence = true
|
||||||
} else {
|
} else {
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
@@ -353,8 +346,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_indic_conjunct_break_extend(this_rune) {
|
if is_indic_conjunct_break_extend(this_rune) {
|
||||||
if current_sequence == .Indic {
|
if current_sequence == .Indic {
|
||||||
if is_indic_conjunct_break_consonant(last_rune) ||
|
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
|
continue_sequence = true
|
||||||
} else {
|
} else {
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
@@ -366,8 +358,7 @@ decode_grapheme_clusters :: proc(
|
|||||||
if is_indic_conjunct_break_linker(this_rune) {
|
if is_indic_conjunct_break_linker(this_rune) {
|
||||||
if current_sequence == .Indic {
|
if current_sequence == .Indic {
|
||||||
if is_indic_conjunct_break_extend(last_rune) ||
|
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
|
continue_sequence = true
|
||||||
} else {
|
} else {
|
||||||
grapheme_count += 1
|
grapheme_count += 1
|
||||||
|
|||||||
Vendored
+14
-28
@@ -454,20 +454,13 @@ when !GL_DEBUG {
|
|||||||
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32) { impl_BeginQueryIndexed(target, index, id) }
|
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32) { impl_BeginQueryIndexed(target, index, id) }
|
||||||
EndQueryIndexed :: proc "c" (target: u32, index: u32) { impl_EndQueryIndexed(target, index) }
|
EndQueryIndexed :: proc "c" (target: u32, index: u32) { impl_EndQueryIndexed(target, index) }
|
||||||
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32) { impl_GetQueryIndexediv(target, index, pname, params) }
|
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32) { impl_GetQueryIndexediv(target, index, pname, params) }
|
||||||
GetTextureHandleARB :: proc "c" (texture: u32) -> u64
|
GetTextureHandleARB :: proc "c" (texture: u32) -> u64 { return impl_GetTextureHandleARB(texture) }
|
||||||
{ return impl_GetTextureHandleARB(texture) }
|
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32) -> u64 { return impl_GetTextureSamplerHandleARB(texture, sampler) }
|
||||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32) -> u64
|
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64 { return impl_GetImageHandleARB(texture, level, layered, layer, format) }
|
||||||
{ return impl_GetTextureSamplerHandleARB(texture, sampler) }
|
MakeTextureHandleResidentARB :: proc "c" (handle: u64) { impl_MakeTextureHandleResidentARB(handle) }
|
||||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32) -> u64
|
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32) { impl_MakeImageHandleResidentARB(handle, access) }
|
||||||
{ return impl_GetImageHandleARB(texture, level, layered, layer, format) }
|
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64) { impl_MakeTextureHandleNonResidentARB(handle) }
|
||||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64)
|
MakeImageHandleNonResidentARB :: proc "c" (handle: u64) { impl_MakeImageHandleNonResidentARB(handle) }
|
||||||
{ impl_MakeTextureHandleResidentARB(handle) }
|
|
||||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32)
|
|
||||||
{ impl_MakeImageHandleResidentARB(handle, access) }
|
|
||||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64)
|
|
||||||
{ impl_MakeTextureHandleNonResidentARB(handle) }
|
|
||||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64)
|
|
||||||
{ impl_MakeImageHandleNonResidentARB(handle) }
|
|
||||||
|
|
||||||
// VERSION_4_1
|
// VERSION_4_1
|
||||||
ReleaseShaderCompiler :: proc "c" () { impl_ReleaseShaderCompiler() }
|
ReleaseShaderCompiler :: proc "c" () { impl_ReleaseShaderCompiler() }
|
||||||
@@ -1265,20 +1258,13 @@ when !GL_DEBUG {
|
|||||||
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32, loc := #caller_location) { impl_BeginQueryIndexed(target, index, id); debug_helper(loc, 0, target, index, id) }
|
BeginQueryIndexed :: proc "c" (target: u32, index: u32, id: u32, loc := #caller_location) { impl_BeginQueryIndexed(target, index, id); debug_helper(loc, 0, target, index, id) }
|
||||||
EndQueryIndexed :: proc "c" (target: u32, index: u32, loc := #caller_location) { impl_EndQueryIndexed(target, index); debug_helper(loc, 0, target, index) }
|
EndQueryIndexed :: proc "c" (target: u32, index: u32, loc := #caller_location) { impl_EndQueryIndexed(target, index); debug_helper(loc, 0, target, index) }
|
||||||
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32, loc := #caller_location) { impl_GetQueryIndexediv(target, index, pname, params); debug_helper(loc, 0, target, index, pname, params) }
|
GetQueryIndexediv :: proc "c" (target: u32, index: u32, pname: u32, params: [^]i32, loc := #caller_location) { impl_GetQueryIndexediv(target, index, pname, params); debug_helper(loc, 0, target, index, pname, params) }
|
||||||
GetTextureHandleARB :: proc "c" (target: u32, loc := #caller_location) -> u64
|
GetTextureHandleARB :: proc "c" (target: u32, loc := #caller_location) -> u64 { ret := impl_GetTextureHandleARB(target); debug_helper(loc, 0, target); return ret }
|
||||||
{ ret := impl_GetTextureHandleARB(target); debug_helper(loc, 0, target); return ret }
|
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32, loc := #caller_location) -> u64 { ret := impl_GetTextureSamplerHandleARB(texture, sampler); debug_helper(loc, 0, texture, sampler); return ret }
|
||||||
GetTextureSamplerHandleARB :: proc "c" (texture, sampler: u32, loc := #caller_location) -> u64
|
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32, loc := #caller_location) -> u64 { ret := impl_GetImageHandleARB(texture, level, layered, layer, format); debug_helper(loc, 0, texture, level, layered, layer, format); return ret }
|
||||||
{ ret := impl_GetTextureSamplerHandleARB(texture, sampler); debug_helper(loc, 0, texture, sampler); return ret }
|
MakeTextureHandleResidentARB :: proc "c" (handle: u64, loc := #caller_location) { impl_MakeTextureHandleResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||||
GetImageHandleARB :: proc "c" (texture: u32, level: i32, layered: bool, layer: i32, format: u32, loc := #caller_location) -> u64
|
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32, loc := #caller_location) { impl_MakeImageHandleResidentARB(handle, access); debug_helper(loc, 0, handle, access) }
|
||||||
{ ret := impl_GetImageHandleARB(texture, level, layered, layer, format); debug_helper(loc, 0, texture, level, layered, layer, format); return ret }
|
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64, loc := #caller_location) { impl_MakeTextureHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||||
MakeTextureHandleResidentARB :: proc "c" (handle: u64, loc := #caller_location)
|
MakeImageHandleNonResidentARB :: proc "c" (handle: u64, loc := #caller_location) { impl_MakeImageHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
||||||
{ impl_MakeTextureHandleResidentARB(handle); debug_helper(loc, 0, handle) }
|
|
||||||
MakeImageHandleResidentARB :: proc "c" (handle: u64, access: u32, loc := #caller_location)
|
|
||||||
{ impl_MakeImageHandleResidentARB(handle, access); debug_helper(loc, 0, handle, access) }
|
|
||||||
MakeTextureHandleNonResidentARB:: proc "c" (handle: u64, loc := #caller_location)
|
|
||||||
{ impl_MakeTextureHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
|
||||||
MakeImageHandleNonResidentARB :: proc "c" (handle: u64, loc := #caller_location)
|
|
||||||
{ impl_MakeImageHandleNonResidentARB(handle); debug_helper(loc, 0, handle) }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user