[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bignum branch
From: |
Andy Moreton |
Subject: |
Re: bignum branch |
Date: |
Wed, 18 Jul 2018 10:28:36 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) |
On Tue 17 Jul 2018, Robert Pluim wrote:
> The interpreter is fine. ccl.el assumes that 'ash' will truncate its
> result, which is no longer true when using bignums. Truncating all ash
> operations to 28 bits in ccl.el fixes this particular error for me,
> but the resulting CCL programs are not identical:
I tried something similar, by truncating the resulting CCL codewords to 28bits.
That fixes compiling the CCL program, but fails in the interpreter. You
can check by running some simple tests:
master (64bit mingw64 MSYS2):
ELISP> (require 'pgg)
pgg
ELISP> (seq-map (lambda (x) (format "#x%x" x)) pgg-parse-crc24)
("#x1" "#x1e" "#xe" "#x1c038" "#x1c057" "#x0" "#xa1" "#x20037"
"#x1" "#x242f9" "#xf" "#x140f7" "#x1" "#x738" "#x20057" "#x1"
"#x63b" "#x5" "#x100" "#x1c037" "#x186" "#x1c057" "#x4cfb"
"#x5bb" "#x10" "#x7" "#xb7" "#x1" "#x3fffffffffffea04"
"#x3fffffffffffe404" "#x16")
ELISP> (ccl-dump pgg-parse-crc24)
nil
ELISP> Out-buffer must be as large as in-buffer.
Main-body:
2:[read-register] read r0 (0 remaining)
3:[set-assign-expr-register] r1 ^= r0
4:[set-assign-expr-const] r2 ^= 0
6:[set-short-const] r5 = 0
7:[set-assign-expr-const] r1 <<= 1
9:[set-expr-const] r7 = r2 >> 15
11:[set-assign-expr-const] r7 &= 1
13:[set-assign-expr-register] r1 += r7
14:[set-assign-expr-const] r2 <<= 1
16:[jump-cond-expr-const] if !(r1 & 256), jump to 23(+7)
19:[set-assign-expr-const] r1 ^= 390
21:[set-assign-expr-const] r2 ^= 19707
23:[jump-cond-expr-const] if !(r5 < 7), jump to 29(+6)
26:[set-assign-expr-const] r5 += 1
28:[jump] jump to 7(-21)
29:[jump] jump to 2(-27)
At EOF:
30:[end] end
ELISP> (dolist (s '("foo" "bar" "baz"))
(let ((crc (pgg-parse-crc24-string s)))
(insert "\n" s " --> "
(mapconcat (lambda (b) (format "%02x" b)) crc ""))))
nil
ELISP>
foo --> 4fc255
bar --> 51d953
baz --> f0586a
bignum (64bit mingw64 MSYS2) with patch for `ash':
ELISP> (require 'pgg)
pgg
ELISP> (seq-map (lambda (x) (format "#x%x" x)) pgg-parse-crc24)
("#x1" "#x1f" "#xe" "#x1c038" "#x1c057" "#x0" "#xa2" "#x0" "#x20037"
"#x1" "#x242f9" "#xf" "#x140f7" "#x1" "#x738" "#x20057" "#x1"
"#x63b" "#x5" "#x100" "#x1c037" "#x186" "#x1c057" "#x4cfb" "#x5bb"
"#x10" "#x7" "#xb7" "#x1" "#xfffea04" "#xfffe304" "#x16")
ELISP> (ccl-dump pgg-parse-crc24)
nil
ELISP> Out-buffer must be as large as in-buffer.
Main-body:
2:[read-register] read r0 (0 remaining)
3:[set-assign-expr-register] r1 ^= r0
4:[set-assign-expr-const] r2 ^= 0
6:[set-const] r5 = 0
8:[set-assign-expr-const] r1 <<= 1
10:[set-expr-const] r7 = r2 >> 15
12:[set-assign-expr-const] r7 &= 1
14:[set-assign-expr-register] r1 += r7
15:[set-assign-expr-const] r2 <<= 1
17:[jump-cond-expr-const] if !(r1 & 256), jump to 24(+7)
20:[set-assign-expr-const] r1 ^= 390
22:[set-assign-expr-const] r2 ^= 19707
24:[jump-cond-expr-const] if !(r5 < 7), jump to 30(+6)
27:[set-assign-expr-const] r5 += 1
29:[jump] jump to 1048584(+1048555)
30:[jump] jump to 1048578(+1048548)
At EOF:
31:[end] end
ELISP> (dolist (s '("foo" "bar" "baz"))
(let ((crc (pgg-parse-crc24-string s)))
(insert "\n" s " --> "
(mapconcat (lambda (b) (format "%02x" b)) crc ""))))
*** Eval error *** Error in CCL program at 30th code
> Someone who know ccl should take a look (or we punt and remove pgg,
> since itʼs obsolete anyway).
If pgg is removed, the CCL interpreter and ccl.el should also be
removed.
AndyM
- Re: bignum branch, (continued)
- Re: bignum branch, Eli Zaretskii, 2018/07/13
- Re: bignum branch, Robert Pluim, 2018/07/13
- Re: bignum branch, Eli Zaretskii, 2018/07/13
- Re: bignum branch, Andy Moreton, 2018/07/15
- Re: bignum branch, Robert Pluim, 2018/07/17
- Re: bignum branch, Eli Zaretskii, 2018/07/17
- Re: bignum branch, Eli Zaretskii, 2018/07/17
- Re: bignum branch, Robert Pluim, 2018/07/17
- Re: bignum branch, Clément Pit-Claudel, 2018/07/17
- Re: bignum branch, Stefan Monnier, 2018/07/17
- Re: bignum branch,
Andy Moreton <=
- Re: bignum branch, Robert Pluim, 2018/07/18
- Re: bignum branch, Stefan Monnier, 2018/07/18
- Re: bignum branch, Eli Zaretskii, 2018/07/18
- Re: bignum branch, Robert Pluim, 2018/07/18
- Re: bignum branch, Eli Zaretskii, 2018/07/18
- Re: bignum branch, Robert Pluim, 2018/07/13
Re: bignum branch, Andy Moreton, 2018/07/13