[fdb] Improve FDB_ALIGN_DOWN macro. The align input parameter NOT depends on 2^N align number.
This commit is contained in:
parent
5ebf8e6e8f
commit
cb84e2c41d
|
@ -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))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue