/* * Read 1 byte from the DHT11 sensor : */ static unsigned rbyte(void) { unsigned x, u = 0; for ( x=0; x<8; ++x ) u = (u << 1) | rbit(); return u; }
inline T math_rand_nan(RNGType &rng) { using U = typename MathFPUIntType<T>::type; mckl::UniformIntDistribution<U> rbit( 0, static_cast<U>(1) << (std::numeric_limits<T>::digits - 4)); mckl::BernoulliDistribution<bool> rquiet; union { T f; U u; }; f = rquiet(rng) ? std::numeric_limits<T>::quiet_NaN() : std::numeric_limits<T>::signaling_NaN(); u |= rbit(rng); return f; }