tesseract  4.0.0-1-g2a2b
BITS16 Class Reference

#include <bits16.h>

Public Member Functions

 BITS16 ()
 
 BITS16 (uint16_t init)
 
void turn_on_bit (uint8_t bit_num)
 
void turn_off_bit (uint8_t bit_num)
 
void set_bit (uint8_t bit_num, bool value)
 
bool bit (uint8_t bit_num) const
 

Public Attributes

uint16_t val
 

Detailed Description

Definition at line 25 of file bits16.h.

Constructor & Destructor Documentation

◆ BITS16() [1/2]

BITS16::BITS16 ( )
inline

Definition at line 30 of file bits16.h.

30  {
31  val = 0;
32  } // constructor
uint16_t val
Definition: bits16.h:28

◆ BITS16() [2/2]

BITS16::BITS16 ( uint16_t  init)
inline

Definition at line 34 of file bits16.h.

34  {
35  val = init;
36  }
uint16_t val
Definition: bits16.h:28

Member Function Documentation

◆ bit()

bool BITS16::bit ( uint8_t  bit_num) const
inline

Definition at line 57 of file bits16.h.

58  { // bit to access
59  return (val >> bit_num) & 01;
60  }
uint16_t val
Definition: bits16.h:28

◆ set_bit()

void BITS16::set_bit ( uint8_t  bit_num,
bool  value 
)
inline

Definition at line 48 of file bits16.h.

50  { // value to flip to
51  if (value)
52  val = val | 01 << bit_num;
53  else
54  val = val & ~(01 << bit_num);
55  }
uint16_t val
Definition: bits16.h:28

◆ turn_off_bit()

void BITS16::turn_off_bit ( uint8_t  bit_num)
inline

Definition at line 43 of file bits16.h.

44  { // bit to flip 0..7
45  val = val & ~(01 << bit_num);
46  }
uint16_t val
Definition: bits16.h:28

◆ turn_on_bit()

void BITS16::turn_on_bit ( uint8_t  bit_num)
inline

Definition at line 38 of file bits16.h.

39  { // bit to flip 0..7
40  val = val | 01 << bit_num;
41  }
uint16_t val
Definition: bits16.h:28

Member Data Documentation

◆ val

uint16_t BITS16::val

Definition at line 28 of file bits16.h.


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