summary refs log tree commit diff
path: root/all.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-12-12 17:36:15 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-12-12 22:16:33 +0100
commitc0f25aeae3ef5d5f4b6bc5678f8d8ce40597d673 (patch)
tree26b78f6db8a8fd46005ce94835b0135a6df4eef7 /all.h
parent2ec355df6adc457303fcf2076b559fefd80ee593 (diff)
downloadroux-c0f25aeae3ef5d5f4b6bc5678f8d8ce40597d673.tar.gz
new rsval() helper for signed Refs
The .val field is signed in RSlot.
Add a new dedicated function to
fetch it as a signed int.
Diffstat (limited to 'all.h')
-rw-r--r--all.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/all.h b/all.h
index 3ddb944..fe2b56b 100644
--- a/all.h
+++ b/all.h
@@ -110,6 +110,11 @@ static inline int rtype(Ref r)
 	return r.type;
 }
 
+static inline int rsval(Ref r)
+{
+	return ((int32_t)r.val << 3) >> 3;
+}
+
 enum CmpI {
 	Cieq,
 	Cine,