* bug#32644: bytevector bug
@ 2018-09-05 17:53 Stefan Israelsson Tampe
2018-09-06 17:27 ` Mark H Weaver
2018-10-14 7:38 ` Mark H Weaver
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Israelsson Tampe @ 2018-09-05 17:53 UTC (permalink / raw)
To: 32644
[-- Attachment #1: Type: text/plain, Size: 966 bytes --]
Hi,
The code velow does not compile when the define-inlinable of id is active.
If in stead
id defined by define is used it all compiles just fine.
Tested on latest tar ball for guile 2.4
-------------------------------------------
(use-modules (rnrs bytevectors))
(define-inlinable (id x) x)
;(define (id x) x)
(define-syntax-rule (mkcrc crc_hqx high xor mask)
(define (crc_hqx data value)
(let ((n (bytevector-length data))
(d data))
(let lp ((i 0) (v value))
(if (< i n)
(let ((b (id (bytevector-u8-ref d i))))
(let lp2 ((j 0) (x 1) (v v))
(if (> j -8)
(let ((bit (ash (logand x b) j))
(hbit (logand v high)))
(if (= hbit 0)
(lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
(lp2 (- j 1) (ash x 1) (logxor
xor
(logand mask
(logior
bit
(ash v 1)))))))
(lp (+ i 1) v))))
v)))))
(mkcrc crc_hqx #x8000 #x1021 #xffff)
(mkcrc crc32 #x80000000 #x04c11db7 #xffffffff)
[-- Attachment #2: Type: text/html, Size: 2166 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#32644: bytevector bug
2018-09-05 17:53 bug#32644: bytevector bug Stefan Israelsson Tampe
@ 2018-09-06 17:27 ` Mark H Weaver
2018-09-14 18:44 ` Stefan Israelsson Tampe
2018-10-14 7:38 ` Mark H Weaver
1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2018-09-06 17:27 UTC (permalink / raw)
To: Stefan Israelsson Tampe; +Cc: 32644
Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
> The code velow does not compile when the define-inlinable of id is active. If in stead
> id defined by define is used it all compiles just fine.
>
> Tested on latest tar ball for guile 2.4
Did you mean to write guile 2.2.4?
Mark
> -------------------------------------------
> (use-modules (rnrs bytevectors))
>
> (define-inlinable (id x) x)
> ;(define (id x) x)
> (define-syntax-rule (mkcrc crc_hqx high xor mask)
> (define (crc_hqx data value)
> (let ((n (bytevector-length data))
> (d data))
> (let lp ((i 0) (v value))
> (if (< i n)
> (let ((b (id (bytevector-u8-ref d i))))
> (let lp2 ((j 0) (x 1) (v v))
> (if (> j -8)
> (let ((bit (ash (logand x b) j))
> (hbit (logand v high)))
> (if (= hbit 0)
> (lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
> (lp2 (- j 1) (ash x 1) (logxor
> xor
> (logand mask
> (logior
> bit
> (ash v 1)))))))
> (lp (+ i 1) v))))
> v)))))
>
> (mkcrc crc_hqx #x8000 #x1021 #xffff)
> (mkcrc crc32 #x80000000 #x04c11db7 #xffffffff)
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#32644: bytevector bug
2018-09-06 17:27 ` Mark H Weaver
@ 2018-09-14 18:44 ` Stefan Israelsson Tampe
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Israelsson Tampe @ 2018-09-14 18:44 UTC (permalink / raw)
To: Mark H Weaver; +Cc: 32644
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
I managed to get it to compile on the latest lightning branch as of
2018-09-14
On Thu, Sep 6, 2018 at 7:28 PM Mark H Weaver <mhw@netris.org> wrote:
> Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
>
> > The code velow does not compile when the define-inlinable of id is
> active. If in stead
> > id defined by define is used it all compiles just fine.
> >
> > Tested on latest tar ball for guile 2.4
>
> Did you mean to write guile 2.2.4?
>
> Mark
>
>
> > -------------------------------------------
> > (use-modules (rnrs bytevectors))
> >
> > (define-inlinable (id x) x)
> > ;(define (id x) x)
> > (define-syntax-rule (mkcrc crc_hqx high xor mask)
> > (define (crc_hqx data value)
> > (let ((n (bytevector-length data))
> > (d data))
> > (let lp ((i 0) (v value))
> > (if (< i n)
> > (let ((b (id (bytevector-u8-ref d i))))
> > (let lp2 ((j 0) (x 1) (v v))
> > (if (> j -8)
> > (let ((bit (ash (logand x b) j))
> > (hbit (logand v high)))
> > (if (= hbit 0)
> > (lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
> > (lp2 (- j 1) (ash x 1) (logxor
> > xor
> > (logand mask
> > (logior
> > bit
> > (ash v 1)))))))
> > (lp (+ i 1) v))))
> > v)))))
> >
> > (mkcrc crc_hqx #x8000 #x1021 #xffff)
> > (mkcrc crc32 #x80000000 #x04c11db7 #xffffffff)
>
[-- Attachment #2: Type: text/html, Size: 1965 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#32644: bytevector bug
2018-09-05 17:53 bug#32644: bytevector bug Stefan Israelsson Tampe
2018-09-06 17:27 ` Mark H Weaver
@ 2018-10-14 7:38 ` Mark H Weaver
1 sibling, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2018-10-14 7:38 UTC (permalink / raw)
To: Stefan Israelsson Tampe; +Cc: 32644-done
Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
> The code velow does not compile when the define-inlinable of id is active. If in stead
> id defined by define is used it all compiles just fine.
The problem was that, in some cases, the type inferrer would call 'ash'
with (- 1 (expt 2 64)) as the second argument during compilation. The
implementation of 'ash' would raise an exception unless its second
argument (the shift count) fits in a C 'long'.
This is fixed in commit 011aec7e240ef987931548d90c53e6692c85d01c on the
stable-2.2 branch. That commit extends 'ash' and 'round-ash' to
gracefully handle several cases where the shift count is too large to
fit in a 'long'.
Thanks for the report.
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-14 7:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 17:53 bug#32644: bytevector bug Stefan Israelsson Tampe
2018-09-06 17:27 ` Mark H Weaver
2018-09-14 18:44 ` Stefan Israelsson Tampe
2018-10-14 7:38 ` Mark H Weaver
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).