macros.h
changeset 2775 a18db0ab5e51
parent 2745 cfce1415ac01
child 2952 58522ed8f0f1
equal deleted inserted replaced
2774:8ab8627b5ba1 2775:a18db0ab5e51
   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 */