From 856442c97da05ede920cec3456e65a704f816065 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Wed, 29 Jun 2022 14:32:14 -0500 Subject: [PATCH] Create proper types for all bit masks --- include/gargoyle/codex.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/gargoyle/codex.h b/include/gargoyle/codex.h index df459c4..cc3eba2 100644 --- a/include/gargoyle/codex.h +++ b/include/gargoyle/codex.h @@ -3,17 +3,21 @@ #include -static const uint8_t GARGOYLE_TYPE_BOOL = 1 << 0; -static const uint8_t GARGOYLE_TYPE_UINT = 1 << 1; -static const uint8_t GARGOYLE_TYPE_DBLE = 1 << 2; -static const uint8_t GARGOYLE_TYPE_ROPE = 1 << 3; +typedef uint8_t gargoyle_opt_type; -static const uint8_t GARGOYLE_ERR_SUCCESS = 0; -static const uint8_t GARGOYLE_ERR_UNKNOWN_OPT = 1; -static const uint8_t GARGOYLE_ERR_VALUE_REQUIRED = 2; -static const uint8_t GARGOYLE_ERR_INVALID_UINT = 3; -static const uint8_t GARGOYLE_ERR_INVALID_DBLE = 4; -static const uint8_t GARGOYLE_ERR_UNKNOWN_TYPE = 5; +static const gargoyle_opt_type GARGOYLE_TYPE_BOOL = 1 << 0; +static const gargoyle_opt_type GARGOYLE_TYPE_UINT = 1 << 1; +static const gargoyle_opt_type GARGOYLE_TYPE_DBLE = 1 << 2; +static const gargoyle_opt_type GARGOYLE_TYPE_ROPE = 1 << 3; + +typedef uint8_t gargoyle_err_type; + +static const gargoyle_err_type GARGOYLE_ERR_SUCCESS = 1 << 0; +static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_OPT = 1 << 1; +static const gargoyle_err_type GARGOYLE_ERR_VALUE_REQUIRED = 1 << 2; +static const gargoyle_err_type GARGOYLE_ERR_INVALID_UINT = 1 << 3; +static const gargoyle_err_type GARGOYLE_ERR_INVALID_DBLE = 1 << 4; +static const gargoyle_err_type GARGOYLE_ERR_UNKNOWN_TYPE = 1 << 5; typedef uint8_t gargoyle_flag_type;