File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ const unpackAny = @import("any.zig").unpackAny;
1616pub fn sizeOfPackedArrayHeader (len : usize ) ! usize {
1717 if (len <= hdrs .FIXARRAY_MAX - hdrs .FIXARRAY_MIN ) {
1818 return 1 ;
19- } else if (len <= std .math .maxInt (u8 )) {
20- return 1 + @sizeOf (u8 );
2119 } else if (len <= std .math .maxInt (u16 )) {
2220 return 1 + @sizeOf (u16 );
2321 } else if (len <= std .math .maxInt (u32 )) {
@@ -141,3 +139,7 @@ test "packArray: null" {
141139test "sizeOfPackedArray" {
142140 try std .testing .expectEqual (1 , sizeOfPackedArray (0 ));
143141}
142+
143+ test "sizeOfPackedArrayHeader: array16 boundary" {
144+ try std .testing .expectEqual (3 , sizeOfPackedArrayHeader (16 ));
145+ }
Original file line number Diff line number Diff line change @@ -17,8 +17,6 @@ const unpackAny = @import("any.zig").unpackAny;
1717pub fn sizeOfPackedMapHeader (len : usize ) ! usize {
1818 if (len <= hdrs .FIXMAP_MAX - hdrs .FIXMAP_MIN ) {
1919 return 1 ;
20- } else if (len <= std .math .maxInt (u8 )) {
21- return 1 + @sizeOf (u8 );
2220 } else if (len <= std .math .maxInt (u16 )) {
2321 return 1 + @sizeOf (u16 );
2422 } else if (len <= std .math .maxInt (u32 )) {
@@ -156,3 +154,7 @@ test "unpackMap unmanaged" {
156154test "sizeOfPackedMap" {
157155 try std .testing .expectEqual (1 , sizeOfPackedMap (0 ));
158156}
157+
158+ test "sizeOfPackedMapHeader: map16 boundary" {
159+ try std .testing .expectEqual (3 , sizeOfPackedMapHeader (16 ));
160+ }
You can’t perform that action at this time.
0 commit comments