Add BCD to decimal conversion macros
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in -59m22s
Builds / ExectOS (amd64, release) (push) Successful in -59m23s
Builds / ExectOS (i686, debug) (push) Successful in -59m22s
Builds / ExectOS (i686, release) (push) Successful in -59m24s

This commit is contained in:
2026-04-24 07:26:22 +02:00
parent 58010c27f4
commit b1e849a251

View File

@@ -58,6 +58,10 @@
/* Macro for calculating size of an array */ /* Macro for calculating size of an array */
#define ARRAY_SIZE(Array) (sizeof(Array) / sizeof(*Array)) #define ARRAY_SIZE(Array) (sizeof(Array) / sizeof(*Array))
/* Macros for converting Binary Coded Decimal (BCD) into decimal and vice versa */
#define BCD_TO_DECIMAL(Value) (((Value) & 0x0F) + (((Value) >> 4) * 10))
#define DECIMAL_TO_BCD(Value) ((((Value) / 10) << 4) | ((Value) % 10))
/* Macros for concatenating two strings */ /* Macros for concatenating two strings */
#define CONCAT_STRING(Str1, Str2) Str1##Str2 #define CONCAT_STRING(Str1, Str2) Str1##Str2
#define CONCATENATE(Str1, Str2) CONCAT_STRING(Str1, Str2) #define CONCATENATE(Str1, Str2) CONCAT_STRING(Str1, Str2)