encoding/cbor: deterministically store bit sets as big endian

This commit is contained in:
Laytan Laats
2024-03-04 17:26:19 +01:00
parent 759d095548
commit 317931a3c5
5 changed files with 30 additions and 27 deletions
+2 -1
View File
@@ -541,7 +541,8 @@ marshal_into_encoder :: proc(e: Encoder, v: any) -> (err: Marshal_Error) {
return marshal_into(e, any{v.data, info.base.id})
case runtime.Type_Info_Bit_Set:
do_byte_swap := is_bit_set_different_endian_to_platform(info.underlying)
// Store bit_set as big endian just like the protocol.
do_byte_swap := !reflect.bit_set_is_big_endian(v)
switch ti.size * 8 {
case 0:
return _encode_u8(e.writer, 0)