[inc/fdb_low_lvl] fix An error occurred in FDB_ALIGN(size, align) when align is not 2 to the nth power (#233)

This commit is contained in:
DarryZh 2023-08-17 18:01:48 +08:00 committed by GitHub
parent fab8a16180
commit 3e441f6c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@
/* Return the most contiguous size aligned at specified width. RT_ALIGN(13, 4)
* would return 16.
*/
#define FDB_ALIGN(size, align) (((size) + (align) - 1) & ~((align) - 1))
#define FDB_ALIGN(size, align) ((size + align - 1) - ((size + align -1) % align))
/* align by write granularity */
#define FDB_WG_ALIGN(size) (FDB_ALIGN(size, (FDB_WRITE_GRAN + 7)/8))
/**