• Petr Špaček's avatar
    rplan: fix kr_qflags_*() to work with more than 32 flags · 4f79b91d
    Petr Špaček authored
    Originally division around sizeof(uint32_t) caused silent truncation
    for struct kr_qflags with sizes not multiple of 4 bytes.
    
    Attempts to optimize using uint32_t blocks could lead to read/write
    beyond end of uint32_t so I'm not willing to risk it.
    
    Also, the code was refactored to avoid duplication between _set and _clear.
    Quick look into assembly produced by gcc 7.2.1 with -O2 on x86_64 confirms that
    all auxiliary functions got inlined so there are not extra function calls.
    
    Unit tests are attached. These fail on the previous version of _set() and
    _clear() and work now.
    4f79b91d
test_rplan.c 2.52 KB