mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-11 23:17:34 +02:00
Official chibi-scheme repository
Previous code was losing the carry bit in 'all ones' case, when adata[i] = bdata[i] = SEXP_UINT_T_MAX, and carry = 1 too. In this case expression (SEXP_UINT_T_MAX - bdata[i] - carry) overflows and yields an incorrect value SEXP_UINT_T_MAX which results into carry being incorrectly set to 0 after addition. We need to avoid the second overflow when calculating the new value of the carry bit. One way to do this is at first check for the overflow in (adata[i] + bdata[i]), and then throw in the (previous) carry bit. I have also given "n" more expressive name and added a comment about the reason why we need that temporary variable. |
||
---|---|---|
benchmarks | ||
build-lib/chibi/char-set | ||
contrib | ||
data | ||
doc | ||
examples | ||
include/chibi | ||
lib | ||
opt | ||
tests | ||
tools | ||
.gitignore | ||
.gitmodules | ||
.hgignore | ||
AUTHORS | ||
bignum.c | ||
chibi-scheme.pc.in | ||
chibi-scheme.vcproj | ||
COPYING | ||
eval.c | ||
fedora.spec | ||
gc.c | ||
main.c | ||
Makefile | ||
Makefile.detect | ||
Makefile.libs | ||
mkfile | ||
opcodes.c | ||
plan9.c | ||
README | ||
README.libs | ||
RELEASE | ||
sexp.c | ||
simplify.c | ||
TODO | ||
VERSION | ||
vm.c |
Chibi-Scheme -------------- Minimal Scheme Implementation for use as an Extension Language http://synthcode.com/wiki/chibi-scheme/ Chibi-Scheme is a very small library intended for use as an extension and scripting language in C programs. In addition to support for lightweight VM-based threads, each VM itself runs in an isolated heap allowing multiple VMs to run simultaneously in different OS threads. The default language is the R7RS (scheme base) library. Support for additional languages such as JavaScript, Go, Lua and Bash are planned for future releases. Scheme is chosen as a substrate because its first class continuations and guaranteed tail-call optimization makes implementing other languages easy. To build on most platforms just run "make && make test". This will provide a shared library "libchibi-scheme", as well as a sample "chibi-scheme" command-line repl. You can then run sudo make install to install the binaries and libraries. You can optionally specify a PREFIX for the installation directory: make PREFIX=/path/to/install/ sudo make PREFIX=/path/to/install/ install By default files are installed in /usr/local. If you want to try out chibi-scheme without installing, be sure to set LD_LIBRARY_PATH so it can find the shared libraries. For more detailed documentation, run "make doc" and see the generated "doc/chibi.html".