mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-15 14:53:43 +00:00
Handle endianness for floats
This commit is contained in:
@@ -454,6 +454,8 @@ is_endian_platform :: proc(info: ^Type_Info) -> bool {
|
|||||||
#partial switch v in info.variant {
|
#partial switch v in info.variant {
|
||||||
case Type_Info_Integer:
|
case Type_Info_Integer:
|
||||||
return v.endianness == .Platform
|
return v.endianness == .Platform
|
||||||
|
case Type_Info_Float:
|
||||||
|
return v.endianness == .Platform
|
||||||
case Type_Info_Bit_Set:
|
case Type_Info_Bit_Set:
|
||||||
return is_endian_platform(v.underlying)
|
return is_endian_platform(v.underlying)
|
||||||
case Type_Info_Pointer:
|
case Type_Info_Pointer:
|
||||||
@@ -476,6 +478,11 @@ is_endian_little :: proc(info: ^Type_Info) -> bool {
|
|||||||
return ODIN_ENDIAN == .Little
|
return ODIN_ENDIAN == .Little
|
||||||
}
|
}
|
||||||
return v.endianness == .Little
|
return v.endianness == .Little
|
||||||
|
case Type_Info_Float:
|
||||||
|
if v.endianness == .Platform {
|
||||||
|
return ODIN_ENDIAN == .Little
|
||||||
|
}
|
||||||
|
return v.endianness == .Little
|
||||||
case Type_Info_Bit_Set:
|
case Type_Info_Bit_Set:
|
||||||
return is_endian_little(v.underlying)
|
return is_endian_little(v.underlying)
|
||||||
case Type_Info_Pointer:
|
case Type_Info_Pointer:
|
||||||
@@ -498,6 +505,11 @@ is_endian_big :: proc(info: ^Type_Info) -> bool {
|
|||||||
return ODIN_ENDIAN == .Big
|
return ODIN_ENDIAN == .Big
|
||||||
}
|
}
|
||||||
return v.endianness == .Big
|
return v.endianness == .Big
|
||||||
|
case Type_Info_Float:
|
||||||
|
if v.endianness == .Platform {
|
||||||
|
return ODIN_ENDIAN == .Big
|
||||||
|
}
|
||||||
|
return v.endianness == .Big
|
||||||
case Type_Info_Bit_Set:
|
case Type_Info_Bit_Set:
|
||||||
return is_endian_big(v.underlying)
|
return is_endian_big(v.underlying)
|
||||||
case Type_Info_Pointer:
|
case Type_Info_Pointer:
|
||||||
|
|||||||
Reference in New Issue
Block a user