mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-23 16:07:52 +00:00
Merge branch 'master' into odin-global-constants-as-enums
This commit is contained in:
@@ -95,6 +95,7 @@ Type_Info_Enumerated_Array :: struct {
|
||||
count: int,
|
||||
min_value: Type_Info_Enum_Value,
|
||||
max_value: Type_Info_Enum_Value,
|
||||
is_sparse: bool,
|
||||
}
|
||||
Type_Info_Dynamic_Array :: struct {elem: ^Type_Info, elem_size: int}
|
||||
Type_Info_Slice :: struct {elem: ^Type_Info, elem_size: int}
|
||||
|
||||
@@ -614,6 +614,10 @@ raw_data :: proc{raw_array_data, raw_slice_data, raw_dynamic_array_data, raw_str
|
||||
@(disabled=ODIN_DISABLE_ASSERT)
|
||||
assert :: proc(condition: bool, message := "", loc := #caller_location) {
|
||||
if !condition {
|
||||
// NOTE(bill): This is wrapped in a procedure call
|
||||
// to improve performance to make the CPU not
|
||||
// execute speculatively, making it about an order of
|
||||
// magnitude faster
|
||||
proc(message: string, loc: Source_Code_Location) {
|
||||
p := context.assertion_failure_proc
|
||||
if p == nil {
|
||||
|
||||
@@ -37,10 +37,8 @@ bswap_64 :: proc "contextless" (x: u64) -> u64 {
|
||||
|
||||
bswap_128 :: proc "contextless" (x: u128) -> u128 {
|
||||
z := transmute([4]u32)x
|
||||
z[0] = bswap_32(z[3])
|
||||
z[1] = bswap_32(z[2])
|
||||
z[2] = bswap_32(z[1])
|
||||
z[3] = bswap_32(z[0])
|
||||
z[0], z[3] = bswap_32(z[3]), bswap_32(z[0])
|
||||
z[1], z[2] = bswap_32(z[2]), bswap_32(z[1])
|
||||
return transmute(u128)z
|
||||
}
|
||||
|
||||
|
||||
+18
-5
@@ -143,11 +143,21 @@ print_int :: proc "contextless" (x: int) { print_i64(i64(x)) }
|
||||
|
||||
print_caller_location :: proc "contextless" (using loc: Source_Code_Location) {
|
||||
print_string(file_path)
|
||||
print_byte('(')
|
||||
print_u64(u64(line))
|
||||
print_byte(':')
|
||||
print_u64(u64(column))
|
||||
print_byte(')')
|
||||
when ODIN_ERROR_POS_STYLE == .Default {
|
||||
print_byte('(')
|
||||
print_u64(u64(line))
|
||||
print_byte(':')
|
||||
print_u64(u64(column))
|
||||
print_byte(')')
|
||||
} else when ODIN_ERROR_POS_STYLE == .Unix {
|
||||
print_byte(':')
|
||||
print_u64(u64(line))
|
||||
print_byte(':')
|
||||
print_u64(u64(column))
|
||||
print_byte(':')
|
||||
} else {
|
||||
#panic("unhandled ODIN_ERROR_POS_STYLE")
|
||||
}
|
||||
}
|
||||
print_typeid :: proc "contextless" (id: typeid) {
|
||||
if id == nil {
|
||||
@@ -250,6 +260,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
|
||||
print_type(info.elem)
|
||||
|
||||
case Type_Info_Enumerated_Array:
|
||||
if info.is_sparse {
|
||||
print_string("#sparse")
|
||||
}
|
||||
print_byte('[')
|
||||
print_type(info.index)
|
||||
print_byte(']')
|
||||
|
||||
Reference in New Issue
Block a user