MCPcopy Create free account
hub / github.com/defold/defold / ceil

Function ceil

engine/dlib/src/basis/encoder/cppspmd_sse.h:1465–1477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1463}
1464
1465CPPSPMD_FORCE_INLINE vfloat ceil(const vfloat& a)
1466{
1467 __m128i abs_a = _mm_and_si128(_mm_castps_si128(a.m_value), _mm_set1_epi32(0x7FFFFFFFU));
1468 __m128i has_fractional = _mm_cmplt_epi32(abs_a, _mm_castps_si128(_mm_set1_ps(8388608.0f)));
1469
1470 __m128i ai = _mm_cvtps_epi32(a.m_value);
1471 __m128 af = _mm_cvtepi32_ps(ai);
1472 __m128 changed = _mm_cvtepi32_ps(_mm_castps_si128(_mm_cmplt_ps(af, a.m_value)));
1473
1474 af = _mm_sub_ps(af, changed);
1475
1476 return vfloat{ blendv_mask_ps(a.m_value, af, _mm_castsi128_ps(has_fractional)) };
1477}
1478
1479// We need to disable unsafe math optimizations for the key operations used for rounding to nearest.
1480// I wish there was a better way.

Callers 15

make_clistMethod · 0.85
TEST_FFunction · 0.85
VulkanSetTextureInternalFunction · 0.85
AsyncProcessCallbackFunction · 0.85
WebGPUSetTextureInternalFunction · 0.85
math_ceilFunction · 0.85

Calls 1

blendv_mask_psFunction · 0.85

Tested by 3

TEST_FFunction · 0.68