aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-14 20:58:51 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-14 20:58:51 +0100
commit96064258ea02be970f1f95093cea4ee877f6dffe (patch)
tree79c26ebd060f52b6ba7cbdfb7fd037157609a996
parentvala does not suddenly die (diff)
downloadsha3sum-96064258ea02be970f1f95093cea4ee877f6dffe.tar.gz
sha3sum-96064258ea02be970f1f95093cea4ee877f6dffe.tar.bz2
sha3sum-96064258ea02be970f1f95093cea4ee877f6dffe.tar.xz
unsigned shift fix (cannot read from stdin)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--README.md2
-rw-r--r--vala/sha3sum.vala4
2 files changed, 3 insertions, 3 deletions
diff --git a/README.md b/README.md
index bd9bb01..d652952 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ COMPLETE STATUS:
Python 3 :: optimised
C ISO C90 :: optimised
Java/C JNI :: under development
- Vala :: incorrect
+ Vala :: correct, under development
NASM :: planned (maybe, after jni)
Haskell :: planned (maybe)
Python 2 :: planned (maybe)
diff --git a/vala/sha3sum.vala b/vala/sha3sum.vala
index e34c47b..5e0b792 100644
--- a/vala/sha3sum.vala
+++ b/vala/sha3sum.vala
@@ -159,7 +159,7 @@ class SHA3 : Object
private int64 rotate(int64 x, int n)
{
int64 m = n % this.w;
- return (((x >> (this.w - m)) & ((1 << m) - 1)) + (x << m)) & this.wmod;
+ return ((int64)((uint64)x >> (this.w - m)) + (x << m)) & this.wmod;
}
@@ -172,7 +172,7 @@ class SHA3 : Object
*/
private int64 rotate64(int64 x, int n)
{
- return ((x >> (64 - n)) & ((1 << n) - 1)) + (x << n);
+ return (int64)((uint64)x >> (64 - n)) + (x << n);
}