From f01deec0765c1f2f81209560aac1cfdf6463b293 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 1 Sep 2004 20:50:30 +0000 Subject: [PATCH] Created macro for calculating the padding required for data length alignment: PAD_LENGTH_FOR_ALIGNMENT --- src/xpdev/gen_defs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xpdev/gen_defs.h b/src/xpdev/gen_defs.h index 10cbdc0d49..9b138d3eb8 100644 --- a/src/xpdev/gen_defs.h +++ b/src/xpdev/gen_defs.h @@ -180,6 +180,13 @@ typedef struct { BOOL value; } named_bool_t; +/************************/ +/* Handy Integer Macros */ +/************************/ + +/* Data Block Length Alignment Macro (returns required padding length for proper alignment) */ +#define PAD_LENGTH_FOR_ALIGNMENT(len,blk) (((len)%(blk))==0 ? 0 : (blk)-((len)%(blk))) + /***********************/ /* Handy String Macros */ /***********************/ @@ -267,4 +274,5 @@ typedef struct { /********************************/ #define COUNT_LIST_ITEMS(list,i) { i=0; if(list!=NULL) while(list[i]!=NULL) i++; } + #endif /* Don't add anything after this #endif statement */ -- GitLab