|
ZVBI Library 0.2.45
|
Macros | |
| #define | vbi_bin2bcd(n) |
| #define | vbi_bcd2bin(n) |
Functions | |
| _vbi_inline unsigned int | vbi_dec2bcd (unsigned int dec) |
| _vbi_inline unsigned int | vbi_bcd2dec (unsigned int bcd) |
| _vbi_inline unsigned int | vbi_add_bcd (unsigned int a, unsigned int b) |
| _vbi_inline vbi_bool | vbi_is_bcd (unsigned int bcd) |
| _vbi_inline vbi_bool | vbi_bcd_digits_greater (unsigned int bcd, unsigned int maximum) |
Teletext page numbers are expressed as packed binary coded decimal numbers in range 0x100 to 0x8FF. The bcd format encodes one decimal digit in every hex nibble (four bits) of the number. Page numbers containing digits 0xA to 0xF are reserved for various system purposes and not intended for display.
| #define vbi_bin2bcd | ( | n | ) |
| #define vbi_bcd2bin | ( | n | ) |
| _vbi_inline unsigned int vbi_dec2bcd | ( | unsigned int | dec | ) |
| dec | Decimal number. |
Converts a two's complement binary between 0 ... 999 to a packed bcd number in range 0x000 ... 0x999. Extra digits in the input will be discarded.
| _vbi_inline unsigned int vbi_bcd2dec | ( | unsigned int | bcd | ) |
| bcd | BCD number. |
Converts a packed bcd number between 0x000 ... 0xFFF to a two's complement binary in range 0 ... 999. Extra digits in the input will be discarded.
| _vbi_inline unsigned int vbi_add_bcd | ( | unsigned int | a, |
| unsigned int | b ) |
| a | BCD number. |
| b | BCD number. |
Adds two packed bcd numbers, returning a packed bcd sum. Arguments and result are in range 0xF000 0000 ... 0x0999 9999, that is -10**7 ... +10**7 - 1 in decimal notation. To subtract you can add the 10's complement, e. g. -1 = 0xF999 9999.
| _vbi_inline vbi_bool vbi_is_bcd | ( | unsigned int | bcd | ) |
| bcd | BCD number. |
Tests if bcd forms a valid BCD number. The argument must be in range 0x0000 0000 ... 0x0999 9999.
FALSE if bcd contains hex digits 0xA ... 0xF. Referenced by vbi_decode_teletext_8301_local_time().
| _vbi_inline vbi_bool vbi_bcd_digits_greater | ( | unsigned int | bcd, |
| unsigned int | maximum ) |
| bcd | Unsigned BCD number. |
| maximum | Unsigned maximum value. |
Compares an unsigned packed bcd number digit-wise against a maximum value, for example 0x295959. maximum can contain digits 0x0 ... 0xF.
TRUE if any digit of bcd is greater than the corresponding digit of maximum.