| 43 | // process_byte function. |
| 44 | template <typename Function> |
| 45 | inline typename std::enable_if< |
| 46 | std::is_same<decltype(std::declval<Function>()(0)), byte*>::value, |
| 47 | void>::type |
| 48 | VLQEncode(Function&& process_byte, int32_t value) { |
| 49 | // This wouldn't handle kMinInt correctly if it ever encountered it. |
| 50 | DCHECK_NE(value, std::numeric_limits<int32_t>::min()); |
| 51 | bool is_negative = value < 0; |
| 52 | // Encode sign in least significant bit. |
| 53 | uint32_t bits = static_cast<uint32_t>((is_negative ? -value : value) << 1) | |
| 54 | static_cast<uint32_t>(is_negative); |
| 55 | VLQEncodeUnsigned(std::forward<Function>(process_byte), bits); |
| 56 | } |
| 57 | |
| 58 | // Wrapper of VLQEncode for std::vector backed storage containers. |
| 59 | template <typename A> |
nothing calls this directly
no test coverage detected