FastLED 3.10.6
Loading...
Searching...
No Matches
int_asm.h File Reference

Detailed Description

Integer arithmetic with a guaranteed instruction shape.

Public entry point for arithmetic where which instructions get emitted matters as much as the value computed – currently the fixed-point MP3 decoder's inner loops, where a recognised idiom against an unrecognised one measured 2 instructions against 40 on riscv32.

function meaning riscv32 armv7-m
mulshift32(x,y) high half of a signed 32x32 product mulh smull
mul_shift_round32<S>(x,y) (x*y + 2^(S-1)) >> S, truncating narrow 10 insns –
wrap_add32(x,y) 32-bit add, defined wraparound add add
wrap_sub32(x,y) 32-bit subtract, defined wraparound sub sub

mulshift32 truncates rather than rounding, and discards nothing above 2^-32 of the exact product. It is emphatically not operand truncation; see platforms/int_asm.h for the measurement that separates them.

Pinned by ci/tests/test_int_asm_codegen.py, which fails if any of these stops compiling to a single arithmetic instruction on a cross-target.

Definition in file int_asm.h.

#include "platforms/int_asm.h"
+ Include dependency graph for int_asm.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::math
 

Functions

template<int Shift>
FASTLED_FORCE_INLINE i32 fl::math::mul_shift_round32 (i32 x, i32 y) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE i32 fl::math::mulshift32 (i32 x, i32 y) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE i32 fl::math::wrap_add32 (i32 x, i32 y) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE i32 fl::math::wrap_sub32 (i32 x, i32 y) FL_NO_EXCEPT