27#if !defined(USE_OPTIMIZED_SHIFTS)
28#if (defined(__AVR__) && defined(__GNUC__))
29#define USE_OPTIMIZED_SHIFTS 1
31#define USE_OPTIMIZED_SHIFTS 0
43static inline uint32_t
lshift(uint32_t
a) {
44#if USE_OPTIMIZED_SHIFTS==1
47 static_assert(b==1 || b==2 || b==3 || b==8 || b==16 || b==24,
48 "Unvalidated shift - confirm gcc produces performant code");
53#if USE_OPTIMIZED_SHIFTS==1
55#pragma GCC diagnostic push
56#pragma GCC diagnostic ignored "-Wunused-function"
129 "mov r18, __zero_reg__\n"
156 "mov r18, __zero_reg__\n"
180 "mov %A0, __zero_reg__\n"
202 "mov %A0, __zero_reg__\n"
227 "mov %A0, __zero_reg__\n"
253 "mov %A0, __zero_reg__\n"
282 "mov %A0, __zero_reg__\n"
299 "mov %B0, __zero_reg__\n"
305 "mov %A0, __zero_reg__\n"
323 "mov %B0, __zero_reg__\n"
325 "mov %A0, __zero_reg__\n"
336#pragma GCC diagnostic pop
349#if USE_OPTIMIZED_SHIFTS==1
351 static_assert(b==1 || b==2 || b==8 || b==16 || b==24,
352 "Unvalidated shift - confirm gcc produces performant code");
357#if USE_OPTIMIZED_SHIFTS==1
359#pragma GCC diagnostic push
360#pragma GCC diagnostic ignored "-Wunused-function"
457 "mov r19, __zero_reg__\n"
484 "mov r19, __zero_reg__\n"
508 "mov %D0, __zero_reg__\n"
530 "mov %D0, __zero_reg__\n"
555 "mov %D0, __zero_reg__\n"
581 "mov %D0, __zero_reg__\n"
610 "mov %D0, __zero_reg__\n"
627 "mov %C0, __zero_reg__\n"
633 "mov %D0, __zero_reg__\n"
651 "mov %C0, __zero_reg__\n"
653 "mov %D0, __zero_reg__\n"
665#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:122
uint32_t rshift< 4U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:394
uint32_t lshift< 15U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:316
uint32_t rshift< 3U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:370
static uint32_t lshift(uint32_t a)
Bitwise left shift - generic, unoptimized, case.
Definition bit_shifts.h:43
uint32_t rshift< 9U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:499
uint32_t lshift< 4U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:66
uint32_t lshift< 11U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:212
uint32_t lshift< 14U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:292
uint32_t rshift< 5U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:420
uint32_t rshift< 6U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:450
uint32_t rshift< 15U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:644
uint32_t rshift< 10U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:518
uint32_t lshift< 10U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:190
uint32_t lshift< 12U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:237
uint32_t rshift< 13U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:591
uint32_t rshift< 14U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:620
static uint32_t rshift_round(uint32_t a)
Rounded arithmetic right shift.
Definition bit_shifts.h:682
uint32_t lshift< 9U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:171
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:348
uint32_t lshift< 13U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:263
uint32_t rshift< 11U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:540
uint32_t rshift< 12U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:565
uint32_t rshift< 7U >(uint32_t a)
uint32_t bitwise right shift optimised for the specified shift distance
Definition bit_shifts.h:477
uint32_t lshift< 5U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:92
uint32_t lshift< 7U >(uint32_t a)
uint32_t bitwise left shift optimised for the specified shift distance
Definition bit_shifts.h:149
static uint8_t a
Definition maths.cpp:7