Skip to content
Snippets Groups Projects
Commit f01deec0 authored by rswindell's avatar rswindell
Browse files

Created macro for calculating the padding required for data length alignment:

PAD_LENGTH_FOR_ALIGNMENT
parent 735151fe
No related branches found
No related tags found
No related merge requests found
...@@ -180,6 +180,13 @@ typedef struct { ...@@ -180,6 +180,13 @@ typedef struct {
BOOL value; BOOL value;
} named_bool_t; } 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 */ /* Handy String Macros */
/***********************/ /***********************/
...@@ -267,4 +274,5 @@ typedef struct { ...@@ -267,4 +274,5 @@ typedef struct {
/********************************/ /********************************/
#define COUNT_LIST_ITEMS(list,i) { i=0; if(list!=NULL) while(list[i]!=NULL) i++; } #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 */ #endif /* Don't add anything after this #endif statement */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment