Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 375fc3f in mainline


Ignore:
Timestamp:
2011-12-04T22:31:39Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
961c0484
Parents:
9fe7d6c
Message:

Add IS_ALIGNED().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/align.h

    r9fe7d6c r375fc3f  
    4242 *
    4343 * @param s Address or size to be aligned.
    44  * @param a Size of alignment, must be power of 2.
     44 * @param a Size of alignment, must be a power of 2.
    4545 */
    4646#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
     
    5050 *
    5151 * @param s Address or size to be aligned.
    52  * @param a Size of alignment, must be power of 2.
     52 * @param a Size of alignment, must be a power of 2.
    5353 */
    5454#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((a) - 1))
     55
     56/** Check alignment.
     57 *
     58 * @param s Address or size to be checked for alignment.
     59 * @param a Size of alignment, must be a power of 2.
     60 */
     61#define IS_ALIGNED(s, a)        (ALIGN_UP((s), (a)) == (s))
    5562
    5663#endif
Note: See TracChangeset for help on using the changeset viewer.