Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
81680ce0
Commit
81680ce0
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Removed comments around part of the truncate stuff. (Anything that doesn't
need shifting.)
parent
d6723f54
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/bignum.lisp
+12
-7
12 additions, 7 deletions
code/bignum.lisp
with
12 additions
and
7 deletions
code/bignum.lisp
+
12
−
7
View file @
81680ce0
...
...
@@ -225,10 +225,10 @@
;;; This takes three digits and returns the FLOOR'ed result of dividing the
;;; first two as a 64-bit integer by the third.
;;;
(
proclaim
'
(
notinline
%floor
))
(
defun
%floor
(
a
b
c
)
(
declare
(
type
bignum-element-type
a
b
c
))
(
error
"Can't truncate bignums."
a
b
c
))
(
let
((
a
a
)
(
b
b
)
(
c
c
))
(
declare
(
type
bignum-element-type
a
b
c
))
(
%floor
a
b
c
)))
;;; %FIXNUM-DIGIT-WITH-CORRECT-SIGN -- Internal.
...
...
@@ -1750,7 +1750,7 @@
|#
#|
;;;; TRUNCATE.
;;;; TRUNCATE.
;;; This is the original sketch of the algorithm from which I implemented this
;;; TRUNCATE, assuming both operands are bignums. I should modify this to work
...
...
@@ -1853,12 +1853,14 @@
(
q
r
)
(
cond
((
<
len-y
2
)
(
bignum-truncate-single-digit
x
len-x
y
))
((
bignum>
y x)
((
plusp
(
bignum-compare
y
x
)
)
(
let
((
res
(
%allocate-bignum
len-x
)))
(
dotimes
(
i
len-x
)
(
setf
(
%bignum-ref
res
i
)
(
%bignum-ref
x
i
)))
(
values
0
res
)))
(
t
(
error
"Can't hack bignum-truncate with large divisors"
)
#+
nil
(
let
((
y-shift
(
shift-y-for-truncate
y
)))
(
multiple-value-bind
(
len-x
len-y
)
(
shift-and-store-truncate-buffers
...
...
@@ -1908,6 +1910,9 @@
(
setf
(
%bignum-ref
rem
0
)
r
)
(
values
q
rem
))))
#|
;;; DO-TRUNCATE -- Internal.
;;;
;;; This divides *truncate-x* by *truncate-y*, and len-x and len-y tell us how
...
...
@@ -2055,8 +2060,8 @@
(if (or (> high-guess*y2 middle-digit)
(and (= middle-digit high-guess*y2)
(> low-guess*y2 x-i-2)))
(progn
(decf guess)
)
(progn
(return guess))))))))
)
(decf guess)
(return guess))))))))
;;; SHIFT-Y-FOR-TRUNCATE -- Internal.
;;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment