Changeset ebb1489 in mainline for kernel/generic/include/align.h


Ignore:
Timestamp:
2024-10-13T08:23:40Z (2 months ago)
Author:
GitHub <noreply@…>
Children:
0472cf17
Parents:
2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
git-committer:
GitHub <noreply@…> (2024-10-13 08:23:40)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

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

    r2a0c827c rebb1489  
    3939#define KERN_ALIGN_H_
    4040
     41#ifdef __ASSEMBLER__
     42#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
     43#define ALIGN_UP(s, a)    (((s) + ((a) - 1)) & ~((a) - 1))
     44#else
     45
    4146/** Align to the nearest lower address.
    4247 *
     
    4449 * @param a Size of alignment, must be a power of 2.
    4550 */
    46 #define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
     51#define ALIGN_DOWN(s, a)  ((s) & ~((typeof(s))(a) - 1))
    4752
    4853/** Align to the nearest higher address.
     
    5156 * @param a Size of alignment, must be a power of 2.
    5257 */
    53 #define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((a) - 1))
     58#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((typeof(s))(a) - 1))
     59
     60#endif
    5461
    5562/** Check alignment.
Note: See TracChangeset for help on using the changeset viewer.