Skip to content
Snippets Groups Projects
  1. Apr 10, 2023
  2. Apr 07, 2023
  3. Apr 06, 2023
  4. Apr 05, 2023
  5. Mar 06, 2023
    • Leah Rowe's avatar
      util/nvmutil: optimise rhex() further · f9e20b8a
      Leah Rowe authored
      reduce the number of calls to read() by using
      bit shifts. when rnum is zero, read again. in
      most cases, a nibble will not be zero, so this
      will usually result in about 13-15 of of 16
      nibbles being used. this is in comparison to
      8 nibbles being used before, which means that
      the number of calls to read() are roughly
      halved. at the same time, the extra amount of
      logic is minimal (and probably less) when
      compiled, outside of calls to read(), because
      shifting is better optimised (on 64-bit machines,
      the uint64_t will be shifted with just a single
      instruction, if the compiler is decent), whereas
      the alternative would be to always precisely use
      exactly 16 nibbles by counting up to 16, which
      would involve the use of an and mask and still
      need a shift, plus...
      
      you get the point. this is probably the most
      efficient code ever written, for generating
      random numbers between the value of 0 and 15
      f9e20b8a
  6. Jan 28, 2023
  7. Jan 27, 2023
  8. Jan 17, 2023