Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:34:21

0001 #ifndef GOOGLE_UPB_UPB_WIRE_WRITER_H__
0002 #define GOOGLE_UPB_UPB_WIRE_WRITER_H__
0003 
0004 #include <stdint.h>
0005 
0006 // Must be last.
0007 #include "upb/port/def.inc"
0008 
0009 UPB_FORCEINLINE uint32_t
0010 UPB_PRIVATE(upb_WireWriter_VarintUnusedSizeFromLeadingZeros64)(uint64_t clz) {
0011   // Calculate how many bytes of the possible 10 bytes we will *not* encode,
0012   // because they are part of a zero prefix. For the number 300, it would use 2
0013   // bytes encoded, so the number of bytes to skip would be 8. Adding 7 to the
0014   // clz input ensures that we're rounding up.
0015   return (((uint32_t)clz + 7) * 9) >> 6;
0016 }
0017 
0018 #include "upb/port/undef.inc"
0019 
0020 #endif  // GOOGLE_UPB_UPB_WIRE_WRITER_H__