From c70d98ef59bddda73cd4d97142a98f1513d11947 Mon Sep 17 00:00:00 2001 From: inmarket Date: Tue, 11 Mar 2014 17:09:00 +1000 Subject: [PATCH] Add bit format testing to sample formats. --- src/gmisc/sys_defs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gmisc/sys_defs.h b/src/gmisc/sys_defs.h index cbb0111b..41a9bca6 100644 --- a/src/gmisc/sys_defs.h +++ b/src/gmisc/sys_defs.h @@ -39,6 +39,16 @@ typedef enum ArrayDataFormat_e { ARRAY_DATA_16BITUNSIGNED = 16, ARRAY_DATA_16BITSIGNED = 17, } ArrayDataFormat; +/** + * @brief Is the sample data format a "signed" data format? + */ +#define gfxSampleFormatIsSigned(fmt) ((fmt) & 1) + +/** + * @brief How many bits are in the sample data format + */ +#define gfxSampleFormatBits(fmt) ((fmt) & ~1) + /** * @brief The type for a fixed point type. * @details The top 16 bits are the integer component, the bottom 16 bits are the real component.