28#if !defined(USE_OPTIMIZED_SHIFTS)
29#if (defined(CORE_AVR) || defined(ARDUINO_ARCH_AVR)) && defined(__GNUC__)
30#define USE_OPTIMIZED_SHIFTS 1
32#define USE_OPTIMIZED_SHIFTS 0
44static inline uint32_t
lshift(uint32_t
a) {
45#if USE_OPTIMIZED_SHIFTS==1
48 static_assert(b==1 || b==2 || b==3 || b==8 || b==16 || b==24,
49 "Unvalidated shift - confirm gcc produces performant code");
54#if USE_OPTIMIZED_SHIFTS==1
56#pragma GCC diagnostic push
57#pragma GCC diagnostic ignored "-Wunused-function"
130 "mov r18, __zero_reg__\n"
157 "mov r18, __zero_reg__\n"
181 "mov %A0, __zero_reg__\n"
203 "mov %A0, __zero_reg__\n"
228 "mov %A0, __zero_reg__\n"
254 "mov %A0, __zero_reg__\n"
283 "mov %A0, __zero_reg__\n"
300 "mov %B0, __zero_reg__\n"
306 "mov %A0, __zero_reg__\n"
324 "mov %B0, __zero_reg__\n"
326 "mov %A0, __zero_reg__\n"
337#pragma GCC diagnostic pop
350#if USE_OPTIMIZED_SHIFTS==1
352 static_assert(b==1 || b==2 || b==8 || b==16 || b==24,
353 "Unvalidated shift - confirm gcc produces performant code");
358#if USE_OPTIMIZED_SHIFTS==1
360#pragma GCC diagnostic push
361#pragma GCC diagnostic ignored "-Wunused-function"
458 "mov r19, __zero_reg__\n"
485 "mov r19, __zero_reg__\n"
509 "mov %D0, __zero_reg__\n"
531 "mov %D0, __zero_reg__\n"
556 "mov %D0, __zero_reg__\n"
582 "mov %D0, __zero_reg__\n"
611 "mov %D0, __zero_reg__\n"
628 "mov %C0, __zero_reg__\n"
634 "mov %D0, __zero_reg__\n"
652 "mov %C0, __zero_reg__\n"
654 "mov %D0, __zero_reg__\n"
666#pragma GCC diagnostic pop
uint32_t lshift< 6U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:123
uint32_t rshift< 4U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:395
uint32_t lshift< 15U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:317
uint32_t rshift< 3U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:371
static uint32_t lshift(uint32_t a)
Bitwise left shift - generic, unoptimized, case.
Definition bit_shifts.h:44
uint32_t rshift< 9U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:500
uint32_t lshift< 4U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:67
uint32_t lshift< 11U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:213
uint32_t lshift< 14U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:293
uint32_t rshift< 5U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:421
uint32_t rshift< 6U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:451
uint32_t rshift< 15U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:645
uint32_t rshift< 10U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:519
uint32_t lshift< 10U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:191
uint32_t lshift< 12U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:238
uint32_t rshift< 13U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:592
uint32_t rshift< 14U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:621
static uint32_t rshift_round(uint32_t a)
Rounded arithmetic right shift.
Definition bit_shifts.h:683
uint32_t lshift< 9U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:172
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
uint32_t lshift< 13U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:264
uint32_t rshift< 11U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:541
uint32_t rshift< 12U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:566
uint32_t rshift< 7U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:478
uint32_t lshift< 5U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:93
uint32_t lshift< 7U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:150
static uint8_t a
Definition maths.cpp:7