Hi,
I’ve added a few functions for bitwise operations. Here is my code in order of appearance in the file.
Maybe it could be useful to others.
Cheers,
Sébastien.
#define cddr(x)            (cdr(cdr(x)))
...
... LOGAND, LOGIOR, LOGXOR, LOGNOT, ASH, LOGBITP, ENDFUNCTIONS };
...
object *fn_logand (object *args, object *env) {
  (void) env;
  int arg1 = integer(first(args));
  int arg2 = integer(second(args));
  int result = arg1 & arg2;
  args = cddr(args);
  while (args != NULL) {
    result = result & integer(car(args));
    args = cdr(args);
  }
  return number(result);
}
object *fn_logior (object *args, object *env) {
  (void) env;
  int arg1 = integer(first(args));
  int arg2 = integer(second(args));
  int result = arg1 | arg2;
  args = cddr(args);
  while (args != NULL) {
    result = result | integer(car(args));
    args = cdr(args);
  }
  return number(result);
}
object *fn_logxor (object *args, object *env) {
  (void) env;
  int arg1 = integer(first(args));
  int arg2 = integer(second(args));
  int result = arg1 ^ arg2;
  args = cddr(args);
  while (args != NULL) {
    result = result ^ integer(car(args));
    args = cdr(args);
  }
  return number(result);
}
object *fn_lognot (object *args, object *env) {
  (void) env;
  int result = integer(car(args));
  return number(~result);
}
object *fn_ash (object *args, object *env) {
  (void) env;
  int value = integer(first(args));
  int count = integer(second(args));
  if (count > 0)
    return number(value << count);
  else
    return number(value >> abs(count));
}
object *fn_logbitp (object *args, object *env) {
  (void) env;
  int index = integer(first(args));
  int value = integer(second(args));
  if (bitRead(value, index) == 1)
    return tee;
  else
    return nil;
}
...
const char string110[] PROGMEM = "logand";
const char string111[] PROGMEM = "logior";
const char string112[] PROGMEM = "logxor";
const char string113[] PROGMEM = "lognot";
const char string114[] PROGMEM = "ash";
const char string115[] PROGMEM = "logbitp";
...
  { string110, fn_logand, 2, 127 },
  { string111, fn_logior, 2, 127 },
  { string112, fn_logxor, 2, 127 },
  { string113, fn_lognot, 1, 1 },
  { string114, fn_ash, 2, 2 },
  { string115, fn_logbitp, 2, 2 },