|
Slim numerical data compression 1.0
|
Include file for the bitstream and derived classes. More...
#include <stdint.h>#include <cstdio>#include "bit_constants.h"Go to the source code of this file.
Classes | |
| class | bitstream |
| Bit stream base class. More... | |
| class | obitstream |
| Output bit stream. More... | |
| class | ibitstream |
| Input bit stream. More... | |
Functions | |
| static unsigned int | bit_size (int32_t i) |
| Find size (on [0,32]) of the smallest # that can hold the integer i. | |
| static unsigned int | bit_size (unsigned int u) |
| Find size (on [1,32]) of the smallest # that can hold the unsigned int u. | |
Include file for the bitstream and derived classes.
|
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.
| i | The number whose size is being checked. |
Referenced by mexp_golomb_write().
|
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.
| u | The number whose size is being checked. |