12#include "src/libdivide/libdivide.h"
39 ,
const libdivide::libdivide_s16_t ÷r
51 inline byte to_byte(int16_t value)
const {
return _factor==1 ? value : _factor==2 ? value>>1 : (
byte)libdivide::libdivide_s16_do(value, &_divider); }
53 inline byte to_byte(int16_t value)
const {
return (
byte)(value/_factor); }
56 inline int16_t
from_byte(
byte in )
const {
return (int16_t)in * _factor; }
61 libdivide::libdivide_s16_t _divider;
Represents a 16-bit value as a byte. Useful for I/O.
Definition: int16_byte.h:25
int16_t from_byte(byte in) const
Convert from a byte.
Definition: int16_byte.h:56
byte to_byte(int16_t value) const
Convert to a byte.
Definition: int16_byte.h:53
constexpr int16_byte(uint8_t factor)
Construct.
Definition: int16_byte.h:37
uint8_t byte
Byte type. This is not defined in any C or C++ standard header.
Definition: int16_byte.h:16