diff --git a/const_mask_extractor.cpp b/const_mask_extractor.cpp new file mode 100644 index 0000000..63f8f9e --- /dev/null +++ b/const_mask_extractor.cpp @@ -0,0 +1,71 @@ +/* Check cf5-opt.vim defs. +VIM: let g:lcppflags="-std=c++11 -O2 -pthread" +VIM: let g:wcppflags="/O2 /EHsc /DWIN32" +VIM-: let g:cppflags=g:Iboost.g:Itbb +VIM-: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy +VIM-: let g:ldlibpath=g:Bboost.g:Btbb +VIM-: let g:argv="" +VIM-: let g:cf5output=0 +*/ +#include +#include +#include + +#define HI_BIT_MASK( m, b ) (!((m)&unsigned(~0)< mask:" << std::setw(10) << ENUM_MASK( i ) + << " shift: " << std::setw(10) << ENUM_SHIFT( i ) + << std::endl; +} + +int main ( void ) +{try{ + + std::cout << std::hex << std::showbase; + test( 0x00000000 ); + test( 0x00000001 ); + test( 0x00000010 ); + test( 0x00000100 ); + test( 0x00001000 ); + test( 0x00010000 ); + test( 0x00100000 ); + test( 0x01000000 ); + test( 0x10000000 ); + test( 0x80000000 ); + test( 0x80008000 ); + test( 0x00100010 ); + test( 0x000040a0 ); + test( 0x000040a0 ); + test( 0x00c04fa0 ); + test( 0xffffffff ); + test( 0xcccccccc ); + + return 0; +} +catch ( const std::exception& e ) +{ + std::cerr << std::endl + << "std::exception(\"" << e.what() << "\")." << std::endl; + return 2; +} +catch ( ... ) +{ + std::cerr << std::endl + << "unknown exception." << std::endl; + return 1; +}} +