c6cecc512cbc

Comments
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 15 Dec 2016 16:35:22 -0500
parents 378a7aae37e3
children de58fc1af1e5
branches/tags (none)
files src/generic-arithmetic.lisp

Changes

--- a/src/generic-arithmetic.lisp	Wed Dec 07 16:12:05 2016 -0500
+++ b/src/generic-arithmetic.lisp	Thu Dec 15 16:35:22 2016 -0500
@@ -28,6 +28,9 @@
 ;;; known to be `number`s at compile time it will compile in the vanilla CL op
 ;;; instead:
 ;;;
+;;;
+;;; No declaration, calls the generic function in this package:
+;;;
 ;;;     (defun foo (x)
 ;;;       (+ 5 x))
 ;;;     (disassemble 'foo)
@@ -45,6 +48,8 @@
 ;;;     ; 61B:       0F0B10           BREAK 16               ; Invalid argument count trap
 ;;;
 ;;;
+;;; Number, calls the Lisp +:
+;;;
 ;;;     (defun foo-number (x)
 ;;;       (declare (type number x))
 ;;;       (+ 5 x))
@@ -66,6 +71,8 @@
 ;;;     ; 6F:       0F0B10           BREAK 16                ; Invalid argument count trap
 ;;;
 ;;;
+;;; Small number, SBCL just compiles down to fixnum addition:
+;;;
 ;;;     (defun foo-byte (x)
 ;;;       (declare (type (unsigned-byte 8) x))
 ;;;       (+ 5 x))
@@ -121,6 +128,7 @@
 (define-generic-operation * cl:* t)
 (define-generic-operation / cl:/ nil)
 
+
 ;;;; Example: Vectors
 ;;; Addition
 (defmethod unary+ ((v vector)) v)