aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calendar
diff options
context:
space:
mode:
authorPaul Eggert2019-07-22 16:26:27 -0700
committerPaul Eggert2019-07-22 16:36:50 -0700
commitc63e7f1bf6151d4bb5fde01890c69cdd515e2df3 (patch)
treedb9958355d3b0a85c9a621ba4f0f07eca391dc2d /lisp/calendar
parentb904a238a5ab759a4d0d8c9ee5c48199febd8f62 (diff)
downloademacs-c63e7f1bf6151d4bb5fde01890c69cdd515e2df3.tar.gz
emacs-c63e7f1bf6151d4bb5fde01890c69cdd515e2df3.zip
Remove no-longer-needed integer overflow code
* lisp/calculator.el (calculator-number-to-string): Use truncate, not calculator-truncate, since integer overflow cannot occur here. * lisp/calendar/cal-persia.el (calendar-persian-year-from-absolute): * lisp/gnus/gnus-agent.el (gnus-agent-read-article-number): * lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum) (nnmaildir--new-number): * lisp/scroll-bar.el (scroll-bar-scale): * lisp/simple.el (beginning-of-buffer, end-of-buffer): Simplify, now that integer overflow cannot occur.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/cal-persia.el8
1 files changed, 1 insertions, 7 deletions
diff --git a/lisp/calendar/cal-persia.el b/lisp/calendar/cal-persia.el
index 897208fd2b4..59fe52a592a 100644
--- a/lisp/calendar/cal-persia.el
+++ b/lisp/calendar/cal-persia.el
@@ -100,13 +100,7 @@ Gregorian date Sunday, December 31, 1 BC."
100 (d2 ; prior days not in n2820 or n768 100 (d2 ; prior days not in n2820 or n768
101 (mod d1 280506)) 101 (mod d1 280506))
102 (n1 ; years not in n2820 or n768 102 (n1 ; years not in n2820 or n768
103 ;; Want: 103 (floor (* 2820 (+ d2 366)) 1029983))
104 ;; (floor (+ (* 2820 d2) (* 2820 366)) 1029983))
105 ;; but that causes overflow, so use the following.
106 ;; Use 366 as the divisor because (2820*366 mod 1029983) is small.
107 (let ((a (floor d2 366))
108 (b (mod d2 366)))
109 (+ 1 a (floor (+ (* 2137 a) (* 2820 b) 2137) 1029983))))
110 (year (+ (* 2820 n2820) ; complete 2820 year cycles 104 (year (+ (* 2820 n2820) ; complete 2820 year cycles
111 (* 768 n768) ; complete 768 year cycles 105 (* 768 n768) ; complete 768 year cycles
112 ;; Remaining years. 106 ;; Remaining years.