missing includes in functor subsystem
fix UB in firstbitset because of signed integer overflow
remove 'shift' from clang sanitizers, it complains about usage of arithmetic shift. Enable -ftrapv with GCC.