Added bitwise and/or

This commit is contained in:
Justin Ethier 2016-09-23 22:40:26 -04:00
parent eb7ac51e95
commit e51092c8c1
2 changed files with 18 additions and 0 deletions

View file

@ -258,6 +258,8 @@ object Cyc_sum(void *data, object cont, int argc, object n, ...);
object Cyc_sub(void *data, object cont, int argc, object n, ...);
object Cyc_mul(void *data, object cont, int argc, object n, ...);
object Cyc_div(void *data, object cont, int argc, object n, ...);
object Cyc_bit_and(void *data, object n1, object n2);
object Cyc_bit_or(void *data, object n1, object n2);
object Cyc_num_op_va_list(void *data, int argc,
object(fn_op(void *, common_type *, object)),
int default_no_args, int default_one_arg, object n,

View file

@ -4500,6 +4500,22 @@ void vpbuffer_free(void **buf)
free(buf);
}
object Cyc_bit_and(void *data, object n1, object n2)
{
Cyc_check_int(data, n1);
Cyc_check_int(data, n2);
return (obj_int2obj(
obj_obj2int(n1) & obj_obj2int(n2)));
}
object Cyc_bit_or(void *data, object n1, object n2)
{
Cyc_check_int(data, n1);
Cyc_check_int(data, n2);
return (obj_int2obj(
obj_obj2int(n1) | obj_obj2int(n2)));
}
/* RNG section */
#define norm 2.328306549295728e-10
#define m1 4294967087.0