Permalink
Browse files

Reindent code using latest version of Slime.

  • Loading branch information...
1 parent 9812d7c commit 98d46f5af60d4e5b7b2169e70aea0da8453ecedd @brown committed Nov 29, 2011
Showing with 110 additions and 110 deletions.
  1. +42 −42 message-test.lisp
  2. +68 −68 portable-float.lisp
View
@@ -143,11 +143,11 @@
;; optional and default fields
(let ((field-info (append +optional-field-info+ +default-field-info+)))
(loop for (field . values) in field-info do
- (let ((has (field-function "HAS-" field))
- (accessor (field-function "" field))
- (value (second values)))
- (is (funcall has m))
- (is (field-equal (funcall accessor m) value)))))
+ (let ((has (field-function "HAS-" field))
+ (accessor (field-function "" field))
+ (value (second values)))
+ (is (funcall has m))
+ (is (field-equal (funcall accessor m) value)))))
(is (pb:has-optionalgroup m))
(is (pb:has-a (pb:optionalgroup m)))
@@ -168,12 +168,12 @@
;; repeated fields
(let ((field-info +repeated-field-info+))
(loop for (field . values) in field-info do
- (let ((accessor (field-function "" field))
- (v0 (first values))
- (v1 (second values)))
- (is (= (length (funcall accessor m)) 2))
- (is (field-equal (aref (funcall accessor m) 0) v0))
- (is (field-equal (aref (funcall accessor m) 1) v1)))))
+ (let ((accessor (field-function "" field))
+ (v0 (first values))
+ (v1 (second values)))
+ (is (= (length (funcall accessor m)) 2))
+ (is (field-equal (aref (funcall accessor m) 0) v0))
+ (is (field-equal (aref (funcall accessor m) 1) v1)))))
(let ((v (pb:repeatedgroup m)))
(is (= (length v) 2))
(is (= (pb:a (aref v 0)) 217))
@@ -203,17 +203,17 @@
(defun expect-packed-fields-set (m)
(loop for (field . values) in +packed-field-info+ do
- (let ((accessor (field-function "" field))
- (v0 (first values))
- (v1 (second values)))
- (is (= (length (funcall accessor m)) 2))
- (is (field-equal (aref (funcall accessor m) 0) v0))
- (is (field-equal (aref (funcall accessor m) 1) v1)))))
+ (let ((accessor (field-function "" field))
+ (v0 (first values))
+ (v1 (second values)))
+ (is (= (length (funcall accessor m)) 2))
+ (is (field-equal (aref (funcall accessor m) 0) v0))
+ (is (field-equal (aref (funcall accessor m) 1) v1)))))
(defun read-message (class-name file-name)
(let ((message (make-instance class-name)))
(with-open-file (input file-name
- :direction :input :element-type 'unsigned-byte)
+ :direction :input :element-type 'unsigned-byte)
(let* ((size (file-length input))
(buffer (make-array size :element-type '(unsigned-byte 8))))
(read-sequence buffer input)
@@ -232,9 +232,9 @@
;; optional and default fields
(let ((field-info (append +optional-field-info+ +default-field-info+)))
(loop for (field . values) in field-info do
- (let ((setter (field-setter field))
- (value (second values)))
- (funcall setter value m))))
+ (let ((setter (field-setter field))
+ (value (second values)))
+ (funcall setter value m))))
(setf (pb:a (pb:optionalgroup m)) 117)
(setf (pb:bb (pb:optional-nested-message m)) 118)
(setf (pb:c (pb:optional-foreign-message m)) 119)
@@ -243,11 +243,11 @@
;; repeated fields
(let ((field-info +repeated-field-info+))
(loop for (field . values) in field-info do
- (let ((accessor (field-function "" field))
- (v0 (first values))
- (v1 (second values)))
- (vector-push-extend v0 (funcall accessor m))
- (vector-push-extend v1 (funcall accessor m)))))
+ (let ((accessor (field-function "" field))
+ (v0 (first values))
+ (v1 (second values)))
+ (vector-push-extend v0 (funcall accessor m))
+ (vector-push-extend v1 (funcall accessor m)))))
(let ((v0 (make-instance 'pb:testalltypes-repeatedgroup))
(v1 (make-instance 'pb:testalltypes-repeatedgroup)))
(setf (pb:a v0) 217)
@@ -288,11 +288,11 @@
;; optional and default fields
(let ((field-info (append +optional-field-info+ +default-field-info+)))
(loop for (field . values) in field-info do
- (let ((has (field-function "HAS-" field))
- (accessor (field-function "" field))
- (default-value (first values)))
- (is (not (funcall has m)))
- (is (field-equal (funcall accessor m) default-value)))))
+ (let ((has (field-function "HAS-" field))
+ (accessor (field-function "" field))
+ (default-value (first values)))
+ (is (not (funcall has m)))
+ (is (field-equal (funcall accessor m) default-value)))))
(is (not (pb:has-optionalgroup m)))
(is (not (pb:has-a (pb:optionalgroup m))))
@@ -313,15 +313,15 @@
;; repeated fields
(let ((field-info +repeated-field-info+))
(loop for (field . nil) in field-info do
- (let ((accessor (field-function "" field)))
- (is (zerop (length (funcall accessor m))))))))
+ (let ((accessor (field-function "" field)))
+ (is (zerop (length (funcall accessor m))))))))
(defun modify-repeated-fields (m)
(let ((field-info +repeated-field-info+))
(loop for (field . values) in field-info do
- (let ((accessor (field-function "" field))
- (v (third values)))
- (setf (aref (funcall accessor m) 1) v))))
+ (let ((accessor (field-function "" field))
+ (v (third values)))
+ (setf (aref (funcall accessor m) 1) v))))
(setf (pb:a (aref (pb:repeatedgroup m) 1)) 517)
(setf (pb::bb (aref (pb:repeated-nested-message m) 1)) 518)
(setf (pb::c (aref (pb:repeated-foreign-message m) 1)) 519)
@@ -330,12 +330,12 @@
(defun expect-repeated-fields-modified (m)
(let ((field-info +repeated-field-info+))
(loop for (field . values) in field-info do
- (let ((accessor (field-function "" field))
- (v0 (first values))
- (v1 (third values)))
- (is (= (length (funcall accessor m)) 2))
- (is (field-equal (aref (funcall accessor m) 0) v0))
- (is (field-equal (aref (funcall accessor m) 1) v1)))))
+ (let ((accessor (field-function "" field))
+ (v0 (first values))
+ (v1 (third values)))
+ (is (= (length (funcall accessor m)) 2))
+ (is (field-equal (aref (funcall accessor m) 0) v0))
+ (is (field-equal (aref (funcall accessor m) 1) v1)))))
(let ((v (pb:repeatedgroup m)))
(is (= (length v) 2))
(is (= (pb:a (aref v 0)) 217))
View
@@ -22,41 +22,41 @@
(let* ((significand lisp-significand)
(exponent (+ lisp-exponent 23 127))
(unsigned-result
- (if (plusp exponent) ; if not obviously denormalized
- (do ()
- (nil)
- (cond (;; special termination case, denormalized
- ;; float number
- (zerop exponent)
- ;; Denormalized numbers have exponent one
- ;; greater than the exponent field.
- (return (ash significand -1)))
- (;; ordinary termination case
- (>= significand (expt 2 23))
- (assert (< 0 significand (expt 2 24)))
- ;; Exponent 0 is reserved for
- ;; denormalized numbers, and 255 is
- ;; reserved for specials like NaN.
- (assert (< 0 exponent 255))
- (return (logior (ash exponent 23)
- (logand significand
- (1- (ash 1 23))))))
+ (if (plusp exponent) ; if not obviously denormalized
+ (do ()
+ (nil)
+ (cond (;; special termination case, denormalized
+ ;; float number
+ (zerop exponent)
+ ;; Denormalized numbers have exponent one
+ ;; greater than the exponent field.
+ (return (ash significand -1)))
+ (;; ordinary termination case
+ (>= significand (expt 2 23))
+ (assert (< 0 significand (expt 2 24)))
+ ;; Exponent 0 is reserved for
+ ;; denormalized numbers, and 255 is
+ ;; reserved for specials like NaN.
+ (assert (< 0 exponent 255))
+ (return (logior (ash exponent 23)
+ (logand significand
+ (1- (ash 1 23))))))
- (t
- ;; Shift as necessary to set bit 24 of
- ;; significand.
- (setf significand (ash significand 1)
- exponent (1- exponent)))))
- (do ()
- ((zerop exponent)
- ;; Denormalized numbers have exponent one
- ;; greater than the exponent field.
- (ash significand -1))
- (unless (zerop (logand significand 1))
- (warn "denormalized SINGLE-FLOAT-BITS ~S losing bits"
- x))
- (setf significand (ash significand -1)
- exponent (1+ exponent))))))
+ (t
+ ;; Shift as necessary to set bit 24 of
+ ;; significand.
+ (setf significand (ash significand 1)
+ exponent (1- exponent)))))
+ (do ()
+ ((zerop exponent)
+ ;; Denormalized numbers have exponent one
+ ;; greater than the exponent field.
+ (ash significand -1))
+ (unless (zerop (logand significand 1))
+ (warn "denormalized SINGLE-FLOAT-BITS ~S losing bits"
+ x))
+ (setf significand (ash significand -1)
+ exponent (1+ exponent))))))
(ecase lisp-sign
(1 unsigned-result)
(-1 (logior unsigned-result (- (expt 2 31)))))))))
@@ -76,40 +76,40 @@
(let* ((significand lisp-significand)
(exponent (+ lisp-exponent 52 1023))
(unsigned-result
- (if (plusp exponent) ; if not obviously denormalized
- (do ()
- (nil)
- (cond (;; special termination case, denormalized
- ;; float number
- (zerop exponent)
- ;; Denormalized numbers have exponent one
- ;; greater than the exponent field.
- (return (ash significand -1)))
- (;; ordinary termination case
- (>= significand (expt 2 52))
- (assert (< 0 significand (expt 2 53)))
- ;; Exponent 0 is reserved for
- ;; denormalized numbers, and 2047 is
- ;; reserved for specials like NaN.
- (assert (< 0 exponent 2047))
- (return (logior (ash exponent 52)
- (logand significand
- (1- (ash 1 52))))))
- (t
- ;; Shift as necessary to set bit 53 of
- ;; significand.
- (setf significand (ash significand 1)
- exponent (1- exponent)))))
- (do ()
- ((zerop exponent)
- ;; Denormalized numbers have exponent one
- ;; greater than the exponent field.
- (ash significand -1))
- (unless (zerop (logand significand 1))
- (warn "denormalized DOUBLE-FLOAT-BITS ~S losing bits"
- x))
- (setf significand (ash significand -1)
- exponent (1+ exponent))))))
+ (if (plusp exponent) ; if not obviously denormalized
+ (do ()
+ (nil)
+ (cond (;; special termination case, denormalized
+ ;; float number
+ (zerop exponent)
+ ;; Denormalized numbers have exponent one
+ ;; greater than the exponent field.
+ (return (ash significand -1)))
+ (;; ordinary termination case
+ (>= significand (expt 2 52))
+ (assert (< 0 significand (expt 2 53)))
+ ;; Exponent 0 is reserved for
+ ;; denormalized numbers, and 2047 is
+ ;; reserved for specials like NaN.
+ (assert (< 0 exponent 2047))
+ (return (logior (ash exponent 52)
+ (logand significand
+ (1- (ash 1 52))))))
+ (t
+ ;; Shift as necessary to set bit 53 of
+ ;; significand.
+ (setf significand (ash significand 1)
+ exponent (1- exponent)))))
+ (do ()
+ ((zerop exponent)
+ ;; Denormalized numbers have exponent one
+ ;; greater than the exponent field.
+ (ash significand -1))
+ (unless (zerop (logand significand 1))
+ (warn "denormalized DOUBLE-FLOAT-BITS ~S losing bits"
+ x))
+ (setf significand (ash significand -1)
+ exponent (1+ exponent))))))
(ecase lisp-sign
(1 unsigned-result)
(-1 (logior unsigned-result (- (expt 2 63)))))))))

0 comments on commit 98d46f5

Please sign in to comment.