aboutsummaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2024-05-19 21:03:50 +0200
committerJavier <dev.git@javispedro.com>2024-05-19 21:03:50 +0200
commit4a8fe8127c57b0953e2ba2ad4da5e45a20300645 (patch)
tree60eacf9089c2883bc78b3fc8bf22dc1a7c456031 /utils.h
parentdfa929d625028dae01c8317823f210a3b056c385 (diff)
downloadvbados-4a8fe8127c57b0953e2ba2ad4da5e45a20300645.tar.gz
vbados-4a8fe8127c57b0953e2ba2ad4da5e45a20300645.zip
add initial support for 2nd wheel & 4-5 mouse buttons
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index 715294e..9b9db2a 100644
--- a/utils.h
+++ b/utils.h
@@ -92,4 +92,11 @@ static int scalei_rem(int x, int srcmax, int dstmax, short *rem);
__value [ax] \
__modify [ax cx dx si]
+/** Sign extend x from b bits to 16. */
+static inline int16_t sign_extend(int16_t x, int b)
+{
+ int m = 16 - b;
+ return (x << m) >> m;
+}
+
#endif