aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <ds@doozer.de>2017-05-24 16:56:19 +0200
committerDimitri Sokolyuk <ds@doozer.de>2017-05-24 16:56:19 +0200
commite354cedc17eaf938d0a74ca4c88ae28bd9091d66 (patch)
tree8c7ff86d99e410f74deb7aebd8fe774570118917
parentfbd86e4398f083cf81b4ff25b6c73e836752fa92 (diff)
kiss
-rw-r--r--main.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/main.go b/main.go
index d6dd434..0e51fc7 100644
--- a/main.go
+++ b/main.go
@@ -91,15 +91,8 @@ func Decode(v uint16) string {
}
func expand(v uint16) int8 {
- switch v {
- case 0: // 00 → 00000000
- return 0
- case 1: // 01 → 00000001
- return 1
- case 2: // 10 → 11111110
- return -2
- case 3: // 11 → 11111111
- return -1
+ if v&2 != 0 {
+ v |= 0xfc
}
- return 0
+ return int8(v)
}