~bakpakin/janet

342a29c7be636707ef56b7c8aee5c41e3002a4b8 — Calvin Rose a month ago 368b891
Fix formatting.
3 files changed, 17 insertions(+), 5 deletions(-)

M examples/ffi/so.c
M src/core/corelib.c
M test/suite-corelib.janet
M examples/ffi/so.c => examples/ffi/so.c +5 -5
@@ 211,13 211,13 @@ int sixints_fn_3(SixInts s, int x) {

EXPORTER
intint stack_spill_fn(uint8_t a, uint8_t b, uint8_t c, uint8_t d,
                   uint8_t e, uint8_t f, uint8_t g, uint8_t h,
                   float i, float j, float k, float l,
                   float m, float n, float o, float p,
                   float s1, int8_t s2, uint8_t s3, double s4, uint8_t s5, intint s6) {
                      uint8_t e, uint8_t f, uint8_t g, uint8_t h,
                      float i, float j, float k, float l,
                      float m, float n, float o, float p,
                      float s1, int8_t s2, uint8_t s3, double s4, uint8_t s5, intint s6) {
    return (intint) {
        (a | b | c | d | e | f | g | h) + (i + j + k + l + m + n + o + p),
        s1 * s6.a + s2 * s6.b + s3 * s4 * s5
        s1 *s6.a + s2 *s6.b + s3 *s4 *s5
    };
}


M src/core/corelib.c => src/core/corelib.c +5 -0
@@ 449,6 449,11 @@ JANET_CORE_FN(janet_core_range,
    }
    count = (count > 0) ? count : 0;
    int32_t int_count = ceil(count);
    if (step > 0.0) {
        janet_assert(start + int_count * step >= stop, "bad range code");
    } else {
        janet_assert(start + int_count * step <= stop, "bad range code");
    }
    JanetArray *array = janet_array(int_count);
    for (int32_t i = 0; i < int_count; i++) {
        array->data[i] = janet_wrap_number(start + i * step);

M test/suite-corelib.janet => test/suite-corelib.janet +7 -0
@@ 69,6 69,13 @@
               (seq [n :range [0 10]] (% n 5 3))
               [0 1 2 0 1 0 1 2 0 1]) "variadic mod")

# linspace range
(assert (deep= @[0 1 2 3] (range 4)) "range 1")
(assert (deep= @[0 1 2 3] (range 3.01)) "range 2")
(assert (deep= @[0 1 2 3] (range 3.999)) "range 3")
(assert (deep= @[0.8 1.8 2.8 3.8] (range 0.8 3.999)) "range 4")
(assert (deep= @[0.8 1.8 2.8 3.8] (range 0.8 3.999)) "range 5")

(assert (< 1.0 nil false true
           (fiber/new (fn [] 1))
           "hi"