mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Use Cyc_remainder
This commit is contained in:
parent
af055ea80c
commit
3f7753149e
1 changed files with 1 additions and 17 deletions
|
@ -1058,23 +1058,7 @@
|
|||
;; Apparently C % is actually the remainder, not modulus
|
||||
(define-c remainder
|
||||
"(void *data, int argc, closure _, object k, object num1, object num2)"
|
||||
" int i, j;
|
||||
Cyc_check_num(data, num1);
|
||||
Cyc_check_num(data, num2);
|
||||
if (obj_is_int(num1)) {
|
||||
i = obj_obj2int(num1);
|
||||
} else /* Must be double: if (type_of(num1) == double_tag)*/ {
|
||||
i = ((double_type *)num1)->value;
|
||||
}
|
||||
if (obj_is_int(num2)) {
|
||||
j = obj_obj2int(num2);
|
||||
} else /* Must be double: if (type_of(num2) == double_tag)*/ {
|
||||
j = ((double_type *)num2)->value;
|
||||
}
|
||||
{
|
||||
object result = obj_int2obj(i % j);
|
||||
return_closcall1(data, k, result);
|
||||
}")
|
||||
" Cyc_remainder(data, k, num1, num2); ")
|
||||
;; From chibi scheme. Cannot use C % operator
|
||||
(define (modulo a b)
|
||||
(let ((res (remainder a b)))
|
||||
|
|
Loading…
Add table
Reference in a new issue