X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcfg%2Fmacros.h;h=17f9c6768d92db83972074b7ed26ba479f1c5451;hb=402c25d02455aa20dfd97dbe5199e714bec6ff9b;hp=e6706f648f66006810ba009c78d42115afead3f1;hpb=ee2224fc0ae7d386a0ab4fc3dd49a8fbab39706a;p=bertos.git diff --git a/bertos/cfg/macros.h b/bertos/cfg/macros.h index e6706f64..17f9c676 100644 --- a/bertos/cfg/macros.h +++ b/bertos/cfg/macros.h @@ -362,6 +362,14 @@ */ typedef uint32_t id_t; +/** + * Check if a pointer is aligned to a certain power-of-2 size + */ +INLINE bool is_aligned(const void *addr, size_t size) +{ + return ((size_t)addr & (size - 1)) == 0; +} + /** \} */ //defgroup macros #endif /* MACROS_H */