MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / read4_to_u32

Function read4_to_u32

app/src/ThirdParty/fast_float.h:1746–1762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1744// Read 4 UC into a u32. Truncates UC if not char.
1745template <typename UC>
1746fastfloat_really_inline FASTFLOAT_CONSTEXPR20 uint32_t
1747read4_to_u32(UC const *chars) {
1748 if (cpp20_and_in_constexpr() || !std::is_same<UC, char>::value) {
1749 uint32_t val = 0;
1750 for (int i = 0; i < 4; ++i) {
1751 val |= uint32_t(uint8_t(*chars)) << (i * 8);
1752 ++chars;
1753 }
1754 return val;
1755 }
1756 uint32_t val;
1757 ::memcpy(&val, chars, sizeof(uint32_t));
1758#if FASTFLOAT_IS_BIG_ENDIAN == 1
1759 val = byteswap_32(val);
1760#endif
1761 return val;
1762}
1763#ifdef FASTFLOAT_SSE2
1764
1765fastfloat_really_inline uint64_t simd_read8_to_u64(__m128i const data) {

Callers 2

fast_float.hFile · 0.85

Calls 2

cpp20_and_in_constexprFunction · 0.85
byteswap_32Function · 0.85

Tested by

no test coverage detected