@@ -410,69 +410,6 @@ fd_bincode_varint_size( ulong val ) {
410410 }
411411}
412412
413- enum {
414- /* All meta tags must fit in 6 bits */
415-
416- /* Primitive types with an implicit encoding length */
417- FD_ARCHIVE_META_CHAR = 0x1 ,
418- FD_ARCHIVE_META_STRING = 0x2 ,
419- FD_ARCHIVE_META_CHAR32 = 0x3 ,
420- FD_ARCHIVE_META_DOUBLE = 0x4 ,
421- FD_ARCHIVE_META_LONG = 0x5 ,
422- FD_ARCHIVE_META_UINT = 0x6 ,
423- FD_ARCHIVE_META_UINT128 = 0x7 ,
424- FD_ARCHIVE_META_BOOL = 0x8 ,
425- FD_ARCHIVE_META_UCHAR = 0x9 ,
426- FD_ARCHIVE_META_UCHAR32 = 0xa ,
427- FD_ARCHIVE_META_UCHAR128 = 0xb ,
428- FD_ARCHIVE_META_UCHAR2048 = 0xc ,
429- FD_ARCHIVE_META_ULONG = 0xd ,
430- FD_ARCHIVE_META_USHORT = 0xe ,
431-
432- /* Meta types which have an encoding length after the short tag */
433- FD_ARCHIVE_META_STRUCT = 0x21 ,
434- FD_ARCHIVE_META_VECTOR = 0x22 ,
435- FD_ARCHIVE_META_DEQUE = 0x23 ,
436- FD_ARCHIVE_META_MAP = 0x24 ,
437- FD_ARCHIVE_META_TREAP = 0x25 ,
438- FD_ARCHIVE_META_OPTION = 0x26 ,
439- FD_ARCHIVE_META_ARRAY = 0x27 ,
440- FD_ARCHIVE_META_STATIC_VECTOR = 0x28 ,
441- };
442-
443- #define FD_ARCHIVE_META_SENTINAL (ushort)0 /* End of structure */
444-
445- static inline int fd_archive_encode_setup_length ( fd_bincode_encode_ctx_t * ctx , void * * offset_out ) {
446- uchar * ptr = (uchar * )ctx -> data ;
447- if ( FD_UNLIKELY ((void * )(ptr + sizeof (uint )) > ctx -> dataend ) )
448- return FD_BINCODE_ERR_OVERFLOW ;
449- /* Skip over length for now but make space for it */
450- * offset_out = ptr ;
451- ctx -> data = ptr + sizeof (uint );
452- return FD_BINCODE_SUCCESS ;
453- }
454-
455- static inline int fd_archive_encode_set_length ( fd_bincode_encode_ctx_t * ctx , void * offset ) {
456- * (uint * )offset = (uint )((uchar * )ctx -> data - ((uchar * )offset + sizeof (uint )));
457- return FD_BINCODE_SUCCESS ;
458- }
459-
460- static inline int fd_archive_decode_setup_length ( fd_bincode_decode_ctx_t * ctx , void * * offset_out ) {
461- uchar * ptr = (uchar * )ctx -> data ;
462- if ( FD_UNLIKELY ((void * )(ptr + sizeof (uint )) > ctx -> dataend ) )
463- return FD_BINCODE_ERR_UNDERFLOW ;
464- /* Skip over length for now and verify it later */
465- * offset_out = ptr ;
466- ctx -> data = ptr + sizeof (uint );
467- return FD_BINCODE_SUCCESS ;
468- }
469-
470- static inline int fd_archive_decode_check_length ( fd_bincode_decode_ctx_t * ctx , void * offset ) {
471- if ( * (uint * )offset != (uint )((uchar * )ctx -> data - ((uchar * )offset + sizeof (uint ))) )
472- return FD_BINCODE_ERR_ENCODING ;
473- return FD_BINCODE_SUCCESS ;
474- }
475-
476413/* Convenience API for deserializing with common allocators */
477414
478415/* fd_bincode_decode_spad decodes a bincode type. The result is
0 commit comments