summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-03-04 22:49:13 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-03-04 22:49:13 +0100
commit58078ba2acf2906885ee1995b64946a4a5eca1a1 (patch)
treead9e05995b727bddd13d3610c54d43649da5ea8e
parent3c7da220ac8f327dc2fe7fec3a2de203fdc670a0 (diff)
downloadebus-alt-58078ba2acf2906885ee1995b64946a4a5eca1a1.tar.gz
ebus-alt-58078ba2acf2906885ee1995b64946a4a5eca1a1.zip
ebus-racket: fix layer7 data2c
-rw-r--r--ebus-racket/layer7.rkt12
1 files changed, 7 insertions, 5 deletions
diff --git a/ebus-racket/layer7.rkt b/ebus-racket/layer7.rkt
index eb37e91..b335ddc 100644
--- a/ebus-racket/layer7.rkt
+++ b/ebus-racket/layer7.rkt
@@ -110,11 +110,13 @@
(+ 256 (bitwise-not v)))
(if (= (bitwise-and highByte 128) 128)
(* -1
- (+ (* 16 (u-not highByte))
- (highNibble (u-not lowByte))
- (/ (lowNibble (u-not lowByte) 16))))
- (+ (* 16 (u-not highByte))
- (highNibble lowByte)
+ (/
+ (+ (arithmetic-shift (u-not highByte) 4)
+ (u-not (highNibble lowByte))
+ (+ (u-not (lowNibble lowByte)) 1))
+ 16.0))
+ (+ (* 16 highByte)
+ (arithmetic-shift lowByte -4)
(/ (lowNibble lowByte) 16))))
;; type byteEnum