From e10c64a0b464aff456de88238c02397f0fa499f9 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Sun, 24 Nov 2024 03:19:12 +0000 Subject: [PATCH] Add a PARAMS_PACK macro for building actor params setters (#2304) --- include/z64actor.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/z64actor.h b/include/z64actor.h index 1e81bab9b7..785cec9cde 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -748,6 +748,10 @@ typedef struct NpcInteractInfo { #define PARAMS_GET_NOSHIFT(p, s, n) \ ((p) & (NBITS_TO_MASK(n) << (s))) +// Moves the `n`-bit value `p` to bit position `s` for building actor parameters by OR-ing these together +#define PARAMS_PACK(p, s, n) \ + (((p) & NBITS_TO_MASK(n)) << (s)) + // Generates a bitmask for bit position `s` of length `n` #define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n)