bitset: optimize the code generated by shifts in common cases

* spot/misc/bitset.hh: Here.
* spot/misc/bitset.cc: New file.
* spot/misc/Makefile.am: Add it.
* spot/twa/acc.hh: Conditionally remove the exception checks around
shift operators.
* spot/misc/common.hh (SPOT_ASSUME): New macro.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-24 17:20:16 +02:00
parent e979791071
commit cc2c4615d0
5 changed files with 118 additions and 55 deletions

View file

@ -125,6 +125,19 @@
#define SPOT_UNIMPLEMENTED() throw std::runtime_error("unimplemented");
#if SPOT_DEBUG
#define SPOT_ASSUME(cond) assert(cond)
#else
#define SPOT_ASSUME(cond) \
do \
{ \
if (!(cond)) \
SPOT_UNREACHABLE_BUILTIN(); \
} \
while (0)
#endif
// Useful when forwarding methods such as:
// auto func(int param) SPOT_RETURN(implem_.func(param));
#define SPOT_RETURN(code) -> decltype(code) { return code; }