[Coding] add tp_bits.h for bit manipulation
[Coding] use tp_bits.h macros for bit manipulation instead of local macros
[Memory] use flags instead of integers for each flag
[Coding] using unsigned int instead of int for flags