[all-commits] [llvm/llvm-project] 649cbc: [libc++] Remove unnecessary division and modulo op...

Peng Liu via All-commits all-commits at lists.llvm.org
Wed Mar 26 09:02:27 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 649cbcc3764c554c9c9839f021d073fa9a9f0515
      https://github.com/llvm/llvm-project/commit/649cbcc3764c554c9c9839f021d073fa9a9f0515
  Author: Peng Liu <winner245 at hotmail.com>
  Date:   2025-03-26 (Wed, 26 Mar 2025)

  Changed paths:
    M libcxx/include/__bit_reference
    M libcxx/include/bitset

  Log Message:
  -----------
  [libc++] Remove unnecessary division and modulo operations in bitset (#121312)

The PR removes the unnecessary division and modulo operations in the
one-word specialization `__bitset<1, _Size>`. The reason is that for the
one-word specialization, we have `__pos < __bits_per_word` (as
`__bitset<1, _Size>` is an implementation detail only used by the public
`bitset`). So `__pos / __bits_per_word == 0` and `__pos / __pos %
__bits_per_word == __pos`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list