[fdb] Improve FDB_ALIGN_DOWN macro. The align input parameter NOT depends on 2^N align number.

This commit is contained in:
armink 2023-11-19 11:34:48 +08:00
parent 5ebf8e6e8f
commit cb84e2c41d
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4) * Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
* would return 12. * would return 12.
*/ */
#define FDB_ALIGN_DOWN(size, align) ((size) & ~((align) - 1)) #define FDB_ALIGN_DOWN(size, align) (((size) / (align)) * (align))
/* align down by write granularity */ /* align down by write granularity */
#define FDB_WG_ALIGN_DOWN(size) (FDB_ALIGN_DOWN(size, (FDB_WRITE_GRAN + 7)/8)) #define FDB_WG_ALIGN_DOWN(size) (FDB_ALIGN_DOWN(size, (FDB_WRITE_GRAN + 7)/8))