From aca911af4aae0315cffc5404c1ca1188faabcdf8 Mon Sep 17 00:00:00 2001 From: "Pierre R. Mai" Date: Sat, 3 Nov 2012 23:12:35 +0100 Subject: [PATCH] Add specific declarations, switch 16bit SBCL to not use rotate-byte. --- keccak-16bit.lisp | 7 +------ keccak-32bit.lisp | 2 +- keccak-64bit.lisp | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/keccak-16bit.lisp b/keccak-16bit.lisp index e7e6e6e..014426d 100644 --- a/keccak-16bit.lisp +++ b/keccak-16bit.lisp @@ -145,7 +145,7 @@ (declare (fixnum y)) (dotimes (x #.+keccak-state-columns+) (declare (fixnum x)) - (let* ((element (+ (* y +keccak-state-columns+) x)) + (let* ((element (+ (the fixnum (* y +keccak-state-columns+)) x)) (part (* element +keccak-state-splits+)) (offset (* element +keccak-1600-lane-byte-width+)) (index (the fixnum (+ start offset)))) @@ -284,11 +284,6 @@ #.*optimize-declaration* #+sbcl (sb-ext:muffle-conditions sb-ext:code-deletion-note)) - #+(and xxx sbcl) - (if (or (zerop offset) (= offset 16)) - value - (sb-rotate-byte:rotate-byte offset (byte 16 0) value)) - #-(and xxx sbcl) (if (or (zerop offset) (= offset 16)) value (logior (the keccak-1600-part (ash (ldb (byte (- 16 offset) 0) value) offset)) diff --git a/keccak-32bit.lisp b/keccak-32bit.lisp index a63c4f6..ddd18ef 100644 --- a/keccak-32bit.lisp +++ b/keccak-32bit.lisp @@ -139,7 +139,7 @@ (declare (fixnum y)) (dotimes (x #.+keccak-state-columns+) (declare (fixnum x)) - (let* ((element (+ (* y +keccak-state-columns+) x)) + (let* ((element (+ (the fixnum (* y +keccak-state-columns+)) x)) (part (* element +keccak-state-splits+)) (offset (* element +keccak-1600-lane-byte-width+)) (index (the fixnum (+ start offset)))) diff --git a/keccak-64bit.lisp b/keccak-64bit.lisp index 924bb64..914851b 100644 --- a/keccak-64bit.lisp +++ b/keccak-64bit.lisp @@ -77,7 +77,7 @@ (declare (type (integer 0 200) rate-bytes)) (dotimes (y +keccak-state-rows+) (dotimes (x +keccak-state-columns+) - (let* ((element (+ (* y +keccak-state-columns+) x)) + (let* ((element (+ (the fixnum (* y +keccak-state-columns+)) x)) (offset (* element +keccak-1600-lane-byte-width+)) (index (the fixnum (+ start offset)))) (when (>= offset rate-bytes)