mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
prevents ub in u3x_cap and u3x_mas
This commit is contained in:
parent
76fbb1d918
commit
bdc7179a28
@ -38,12 +38,15 @@
|
||||
|
||||
/* u3x_cap(): root axis, 2 or 3.
|
||||
*/
|
||||
# define u3x_cap(a_w) (0x2 | (a_w >> (u3x_dep(a_w) - 1)))
|
||||
# define u3x_cap(a_w) ({ \
|
||||
c3_assert( 1 < a_w ); \
|
||||
(0x2 | (a_w >> (u3x_dep(a_w) - 1))); })
|
||||
|
||||
/* u3x_mas(): remainder after cap.
|
||||
*/
|
||||
# define u3x_mas(a_w) \
|
||||
( (a_w & ~(1 << u3x_dep(a_w))) | (1 << (u3x_dep(a_w) - 1)) )
|
||||
# define u3x_mas(a_w) ({ \
|
||||
c3_assert( 1 < a_w ); \
|
||||
( (a_w & ~(1 << u3x_dep(a_w))) | (1 << (u3x_dep(a_w) - 1)) ); })
|
||||
|
||||
/* u3x_peg(): connect two axes.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user