#include <stdint.h>
#include <cstdio>
#include "bit_constants.h"
Go to the source code of this file.
|
static unsigned int | bit_size (int32_t i) |
| Find size (on [0,32]) of the smallest # that can hold the integer i. More...
|
|
static unsigned int | bit_size (unsigned int u) |
| Find size (on [1,32]) of the smallest # that can hold the unsigned int u. More...
|
|
Include file for the bitstream and derived classes.
◆ bit_size() [1/2]
static unsigned int bit_size |
( |
int32_t |
i | ) |
|
|
inlinestatic |
Find size (on [0,32]) of the smallest # that can hold the integer i.
By our convention, [-1,0] require 1 bit, [-2,1] require 2 bits, [-4,-3, 2,3] require 3 bits, etc. This was implemented as loops, but we find we save a lot of compute cycles by laying it out as an explicit tree of tests.
- Parameters
-
i | The number whose size is being checked. |
Referenced by mexp_golomb_write().
◆ bit_size() [2/2]
static unsigned int bit_size |
( |
unsigned int |
u | ) |
|
|
inlinestatic |
Find size (on [1,32]) of the smallest # that can hold the unsigned int u.
By our convention, [0,1] require 1 bit, [2,3] require 2 bits, [4,5, 6,7] require 3 bits, etc.
- Parameters
-
u | The number whose size is being checked. |