aboutsummaryrefslogtreecommitdiff
path: root/libbb/read_key.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-10-25 17:40:57 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-10-25 17:40:57 +0200
commitf39a71817ead331b664bc658ac26dec4ec3b75bc (patch)
treec132fc41c35ac0c5e05473df32f5ac8d4b7166bc /libbb/read_key.c
parentd6ff27de153c8f9361de13f75c7f7ed319044f7c (diff)
downloadbusybox-f39a71817ead331b664bc658ac26dec4ec3b75bc.tar.gz
read_key(): placate "warning: shifting a negative signed value is undefined"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/read_key.c')
-rw-r--r--libbb/read_key.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/read_key.c b/libbb/read_key.c
index 951786869..03b7da656 100644
--- a/libbb/read_key.c
+++ b/libbb/read_key.c
@@ -259,7 +259,8 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
buffer[-1] = 0;
/* Pack into "1 <row15bits> <col16bits>" 32-bit sequence */
- col |= (((-1 << 15) | row) << 16);
+ row |= ((unsigned)(-1) << 15);
+ col |= (row << 16);
/* Return it in high-order word */
return ((int64_t) col << 32) | (uint32_t)KEYCODE_CURSOR_POS;
}