macros.h
changeset 2775 d3ed38a97250
parent 2745 d6e90ee9704c
child 2952 6a26eeda9679
child 9918 a151c4749c7a
equal deleted inserted replaced
2774:4b7d8beec975 2775:d3ed38a97250
   162  * Return the smallest multiple of n equal or greater than x
   162  * Return the smallest multiple of n equal or greater than x
   163  * @note n must be a power of 2
   163  * @note n must be a power of 2
   164  */
   164  */
   165 #define ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
   165 #define ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
   166 
   166 
   167 /* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */
       
   168 static inline bool IsValidAsciiChar(byte key)
       
   169 {
       
   170 	// XXX This filter stops certain crashes, but may be too restrictive.
       
   171 	return IS_INT_INSIDE(key, ' ', 127) ||
       
   172 		(IS_INT_INSIDE(key, 160, 256) &&
       
   173 		key != 0xAA && key != 0xAC && key != 0xAD && key != 0xAF &&
       
   174 		key != 0xB5 && key != 0xB6 && key != 0xB7 && key != 0xB9);
       
   175 }
       
   176 
       
   177 #endif /* MACROS_H */
   167 #endif /* MACROS_H */