Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
fml::BitConverter< from_length, to_length, buffer_length > Class Template Reference

#include <base32.h>

Public Member Functions

void Append (int bits)
 
int Extract ()
 
int Peek () const
 
int BitsAvailable () const
 
bool CanAppend () const
 
bool CanExtract () const
 

Detailed Description

template<int from_length, int to_length, int buffer_length>
class fml::BitConverter< from_length, to_length, buffer_length >

Definition at line 16 of file base32.h.

Member Function Documentation

◆ Append()

template<int from_length, int to_length, int buffer_length>
void fml::BitConverter< from_length, to_length, buffer_length >::Append ( int  bits)
inline

Definition at line 18 of file base32.h.

18 {
19 FML_DCHECK(bits >= 0 && bits < (1 << from_length));
21 lower_free_bits_ -= from_length;
22 buffer_ |= (bits << lower_free_bits_);
23 }
bool CanAppend() const
Definition base32.h:35
#define FML_DCHECK(condition)
Definition logging.h:103

◆ BitsAvailable()

template<int from_length, int to_length, int buffer_length>
int fml::BitConverter< from_length, to_length, buffer_length >::BitsAvailable ( ) const
inline

Definition at line 34 of file base32.h.

34{ return buffer_length - lower_free_bits_; }

◆ CanAppend()

template<int from_length, int to_length, int buffer_length>
bool fml::BitConverter< from_length, to_length, buffer_length >::CanAppend ( ) const
inline

Definition at line 35 of file base32.h.

35{ return lower_free_bits_ >= from_length; }

◆ CanExtract()

template<int from_length, int to_length, int buffer_length>
bool fml::BitConverter< from_length, to_length, buffer_length >::CanExtract ( ) const
inline

Definition at line 36 of file base32.h.

36{ return BitsAvailable() >= to_length; }
int BitsAvailable() const
Definition base32.h:34

◆ Extract()

template<int from_length, int to_length, int buffer_length>
int fml::BitConverter< from_length, to_length, buffer_length >::Extract ( )
inline

Definition at line 25 of file base32.h.

25 {
27 int result = Peek();
28 buffer_ = (buffer_ << to_length) & kMask;
29 lower_free_bits_ += to_length;
30 return result;
31 }
int Peek() const
Definition base32.h:33
bool CanExtract() const
Definition base32.h:36
GAsyncResult * result

◆ Peek()

template<int from_length, int to_length, int buffer_length>
int fml::BitConverter< from_length, to_length, buffer_length >::Peek ( ) const
inline

Definition at line 33 of file base32.h.

33{ return (buffer_ >> (buffer_length - to_length)); }

The documentation for this class was generated from the following file: