Alexei Lozovsky
6f35aa75f4
Fix usage of signbit() in SRFI 144
...
C standard defines signbit() as a macro returning "non-zero value" for
negative arguments (see 7.12.3.6 of C11 standard). SRFI 144's flsign-bit
is defined to return exactly 1.
Make sure to convert the result of signbit() call into "boolean int"
which is either 0 or 1.
This is not a theoretical issue. This causes SRFI 144 test suite to fail
on many architectures that are not x86_64.
GCC on x86_64 compiles signbit() as
movmskpd %xmm0, %eax
andl $1, %eax
which indeed returns either 0 or 1. movmskpd extracts 2-bit sign mask
from the FP value in src register and stores that in low-order bits of
the dst register. Then the unneded extra bit is masked out, leaving only
the lowest bit set or unset.
However, other architectures don't have such conveniences and go with
more direct approach. For example, GCC on ARMv7 produces this:
sub sp, sp, #8
vstr.64 d0, [sp]
ldr r0, [sp, #4 ]
and r0, r0, #0x80000000
add sp, sp, #8
bx lr
which effectively returns either 0 or -1. Generated code masks out
everything but the sign bit and returns the result as is. The value
0x80000000 is the representation of -1.
Even on i386 signbit() is compiled as
fldl 4(%esp)
fxam
fnstsw %ax
fstp %st(0)
andl $512, %eax
ret
which effectively returns either 0 or 512: fxam sets C1 bit FPU status
word to the sign of FP value, then the status word is extracted, the
"sign bit" is masked out, and left as is.
2021-06-06 13:49:44 +09:00
Alex Shinn
037a7b24fc
exporting array-coeffs
2021-05-10 22:56:36 +09:00
Alex Shinn
3eab7bf226
package SRFI 179
2021-05-10 17:49:02 +09:00
Alex Shinn
6e5278b7a1
separating out SRFI 179 base library
2021-05-07 22:39:53 +09:00
Alex Shinn
ca47a41ccf
array simplification and performance tweaks
2021-05-07 16:15:48 +09:00
Alex Shinn
12ad1d37d8
add docs and tests for assert, unify with SRFI 145
2021-05-06 20:34:03 +09:00
Alex Shinn
e3083062fa
Flattening indexing further.
...
We can pre-subtract each coeff times its lower bound from the
base coefficient in SRFI 179 indexers.
2021-04-30 14:25:39 +09:00
Alex Shinn
d11106b2f7
Fix upper bounds checks in u64vectors.
2021-04-30 14:02:29 +09:00
Alex Shinn
3c138dc808
Fix validation on specialized-array-reshape.
2021-04-30 13:38:53 +09:00
Alex Shinn
76284f79f0
flattening array indexers
2021-04-28 22:53:16 +09:00
Alex Shinn
cd5bf03537
Merge pull request #740 from lassik/219
...
Add SRFI 219: Define higher-order lambda
2021-04-18 18:58:39 +09:00
Lassi Kortela
7178d22928
Add SRFI 219: Define higher-order lambda
2021-04-18 12:21:32 +03:00
Alex Shinn
d0510bebe6
simplify array-reduce
2021-04-16 23:35:16 +09:00
Alex Shinn
c8f5f49890
add initial SRFI 179 implementation
2021-04-16 19:53:51 +09:00
Alex Shinn
487ea21d77
check value domains on uvector-set! ops
2021-04-16 10:13:37 +09:00
Alex Shinn
fc6e5da915
make-u1vector takes an optional fill
2021-04-15 17:02:44 +09:00
Alex Shinn
e74614d4b3
removing redundant uvector definitions
2021-04-14 17:06:34 +09:00
Alex Shinn
8b27ce9726
add proper grammar support to srfi 130 string-split
2021-04-02 13:51:02 +09:00
Alex Shinn
adec61993b
adding domain checks on uvector accessors
2021-03-26 17:34:25 +09:00
Lassi Kortela
fa52b4987a
Add SRFI 193 Scheme library
...
This was accidentally left out of the previous commit.
2021-02-05 14:08:31 +02:00
Alex Shinn
9f0ed1a869
Revert "Implement SRFI 193: Command lines"
2021-01-24 19:57:55 +09:00
Alex Shinn
751675c6b2
Merge pull request #619 from lassik/command-lines
...
Implement SRFI 193: Command lines
2021-01-24 16:44:35 +09:00
Alex Shinn
0597ea68a5
save a char and a beta reduction
2020-11-25 14:39:49 +09:00
Marc Nieper-Wißkirchen
306dbd470a
Fix and-let* so that it allows bodies according to SRFI 2.
2020-10-22 15:13:04 +02:00
Marc Nieper-Wißkirchen
251464eade
Translate assume to a noop when assumptions are disabled
2020-08-29 11:11:46 +02:00
Marc Nieper-Wißkirchen
043e4c2214
Fix generator-find
2020-08-29 10:25:23 +02:00
krzygorz
9067c8b5d5
text attribute resetting fix
2020-08-24 13:52:29 +02:00
Alex Shinn
d75ae9304f
forgot to export make-state-variable from composite library
2020-08-17 22:02:15 +09:00
Alex Shinn
6be0e8d059
exporting make-state-variable in SRFI 166 (issue #683 )
2020-08-17 21:56:57 +09:00
Alex Shinn
5ee7ad0230
allow start/end args to uvector->vector conversions (issue #682 )
2020-08-16 08:06:22 +09:00
Arvydas Silanskas
cf40f1aca1
add fl-epsilon to srfi 144
2020-08-11 21:26:42 +03:00
Alex Shinn
31c2adf8bf
hash raw bytes of bignums
2020-08-11 11:12:04 +09:00
Alex Shinn
dc524feabc
add missing trailing ? on SRFI 144 inequality ops
2020-08-11 10:37:23 +09:00
Alex Shinn
5616d2fb87
adding uvector-segment test
2020-08-11 10:36:52 +09:00
Alex Shinn
a8e35f90fa
s/max/max in vector-segment (issue #677 )
2020-08-08 16:20:01 +09:00
Alex Shinn
ffeb960997
fixing uvector-reverse-copy (issue #676 ); ungeneralize unfold to take exactly one seed
2020-08-08 16:14:57 +09:00
Alex Shinn
90f0425c37
fixing distribution of random bignums, adding uniformity tests on the results (issue #675 )
2020-08-07 12:40:07 +09:00
Alex Shinn
449312d3bd
restoring hashing of trailing data for uvectors
2020-08-04 18:31:20 +09:00
Alex Shinn
b4520b31f5
hash should not take into account non-sexp trailing data (bug report from Arthur Gleckler)
2020-08-04 12:23:22 +09:00
Lassi Kortela
65b197f7de
Implement SRFI 193: Command lines
2020-08-03 13:24:18 +03:00
Alex Shinn
5d2a9bcc3d
SRFI 160 vector= differs from SRFI 133 in not taking an eq predicate (issue #674 )
2020-07-31 15:09:46 +09:00
Alex Shinn
b7ffc4e700
Revert "SRFI 160 vector= differs from SRFI 133 in not taking an eq predicate (issue #674 )"
...
This reverts commit 340c5aa2a8
.
2020-07-31 15:08:59 +09:00
Alex Shinn
340c5aa2a8
SRFI 160 vector= differs from SRFI 133 in not taking an eq predicate (issue #674 )
2020-07-31 15:00:03 +09:00
Alex Shinn
c726273c3b
fixing distribution of random bignums
2020-07-29 12:15:20 +09:00
Alex Shinn
82acca4772
remove more tabs
2020-07-28 20:10:31 +09:00
Alex Shinn
648f615b77
tabs in srfi 146
2020-07-28 15:29:49 +09:00
Alex Shinn
d593a5cb0a
death to tabs
2020-07-28 15:26:42 +09:00
Alex Shinn
edcddd7299
fixing 64-bit uvectors
2020-07-27 16:08:24 +09:00
Alex Shinn
97ea47686e
implementing substring/preserve
2020-07-21 14:05:30 +09:00
Alex Shinn
bde8a618ec
comments from adam nelson: fixing numeric/comma arg, wrapped doesn't append final newline
2020-07-20 17:41:34 +09:00