Skip to content

Commit b428cba

Browse files
No bit field insert, it annoyed me
1 parent 96b7fc2 commit b428cba

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

Src/HALAL/Services/Time/Scheduler.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@
2222

2323
#define Scheduler_global_timer ((TIM_TypeDef*)Scheduler::global_timer_base)
2424

25-
/* bit field insert
26-
* (internally) mask = ((1UL << width) - 1) << pos
27-
* dest = (dest & ~mask) | (source & mask)
28-
* With the condition that pos and width are immediate values
29-
* ref: https://developer.arm.com/documentation/dui0646/c/The-Cortex-M7-Instruction-Set/Bit-field-instructions/BFC-and-BFI
30-
*/
31-
#define BFI(dest, source, pos, width) \
32-
__asm__( \
33-
"bfi %0, %1, %2, %3" \
34-
: "+r" (dest) \
35-
: "r" (source), "i" (pos), "i" (width) \
36-
)
37-
3825
namespace {
3926
constexpr uint64_t kMaxIntervalUs =
4027
static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()) + 1ULL;
@@ -208,7 +195,7 @@ void Scheduler::remove_sorted(uint8_t id) {
208195
pattern_32 = pattern_32 + (pattern_32 << 8);
209196
pattern_32 = pattern_32 + (pattern_32 << 16);
210197
uint64_t pattern = pattern_32;
211-
BFI(((uint32_t*)&pattern)[1], pattern_32, 0, 32);
198+
((uint32_t*)&pattern)[1] = pattern_32;
212199

213200
#pragma GCC diagnostic pop
214201

0 commit comments

Comments
 (0)