• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillwater-sc / universal / 24907312588
84%
master: 84%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 24 Apr 2026 07:40PM UTC
Jobs 1
Files 633
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Apr 2026 07:12PM UTC coverage: 84.392% (+0.02%) from 84.371%
24907312588

push

github

web-flow
feat(bfloat16): full constexpr support across all operators (#751)

* feat(bfloat16): full constexpr support across all operators

Replace std::memcpy with sw::bit_cast for the float<->uint32 punning at the
heart of bfloat16's IEEE-754 conversion. memcpy is decorated constexpr in
the existing code but is not actually constexpr until C++26; bit_cast is
constexpr today via __builtin_bit_cast on gcc/clang/MSVC modern.

Once the conversion functions are BIT_CAST_CONSTEXPR, almost everything
else falls in line because bfloat16 arithmetic is just float arithmetic
through the conversion (and IEEE-754 float operators are constexpr in
C++20).

Promoted to constexpr / BIT_CAST_CONSTEXPR:
  convert_signed, convert_unsigned, convert_ieee754, convert_to_ieee754
  bfloat16(int/long/long long/unsigned/.../float/double/long double) ctors
  operator=(int/long/.../float/double/long double)
  operator+=, -=, *=, /=
  operator++, --, prefix unary -
  operator float, double, signed/unsigned char, short, int, long, long long
  operator==, !=, <, <=, >, >= (free + literal-comparison overloads)

operator=(char) gets the same signedness dispatch we used in the posit
constexpr work (#714) -- if constexpr (std::is_signed_v<char>) selects
convert_signed, otherwise convert_unsigned, so negative chars on
signed-char platforms (the common case) sign-extend correctly.

Tests:
- static/float/bfloat16/api/api.cpp gets a #if BIT_CAST_IS_CONSTEXPR
  guarded block that exercises the constexpr contract via lambdas and
  static_asserts (constexpr +=, *=, -=, /=, conversion-out, comparison)
  plus runtime cross-checks for bit-equivalence.

Validation (gcc-13 + clang-18, -std=c++20):
  bfloat16_api, bfloat16_attributes, bfloat16_constants, bfloat16_traits,
  bfloat16_arithmetic - PASS on both compilers

Resolves #725
Relates to #723 (Epic: constexpr support across Universal number systems)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(bfloat16): align literal-c... (continued)

47 of 49 new or added lines in 1 file covered. (95.92%)

8 existing lines in 1 file now uncovered.

44952 of 53266 relevant lines covered (84.39%)

6450119.32 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
85.82
-0.05% include/sw/universal/number/bfloat16/bfloat16_impl.hpp

Coverage Regressions

Lines Coverage ∆ File
8
93.53
-0.48% include/sw/universal/number/cfloat/cfloat_impl.hpp
Jobs
ID Job ID Ran Files Coverage
1 24907312588.1 24 Apr 2026 07:40PM UTC 633
84.39
GitHub Action Run
Source Files on build 24907312588
  • Tree
  • List 633
  • Changed 5
  • Source Changed 1
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24907312588
  • fbed35d6 on github
  • Prev Build on main (#24881139213)
  • Next Build on main (#24916020162)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc