File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ struct Scheduler {
101101 return (uint8_t )((sorted_task_ids_ >> (idx * 4 )) & 0xF );
102102 }
103103 static HYPER_INLINE void set_at (uint8_t idx, uint8_t id) {
104- uint32_t shift = idx * 4 ;
105- uint64_t clearmask = ~(0xFFULL << shift);
106- Scheduler::sorted_task_ids_ = (sorted_task_ids_ & clearmask) | (id << shift);
104+ uint64_t shift = idx * 4 ;
105+ uint64_t clearmask = ~(0x0FULL << shift);
106+ Scheduler::sorted_task_ids_ = (sorted_task_ids_ & clearmask) | (( uint64_t ) id << shift);
107107 }
108108 static HYPER_INLINE uint8_t front_id () { return *((uint8_t *)&sorted_task_ids_) & 0xF ; }
109109 static HYPER_INLINE void pop_front () {
Original file line number Diff line number Diff line change @@ -40,6 +40,15 @@ TEST_F(SchedulerTests, GetAt) {
4040 }
4141}
4242
43+ TEST_F (SchedulerTests, SetAt) {
44+ uint64_t original = 0x1EDCBA9876543210ULL ;
45+ for (uint64_t i = 0 ; i < 16 ; i++) {
46+ Scheduler::sorted_task_ids_ = original;
47+ Scheduler::set_at (i, 0xF );
48+ EXPECT_EQ (Scheduler::sorted_task_ids_, original | (0xFULL << (i*4 )));
49+ }
50+ }
51+
4352TEST_F (SchedulerTests, FreeBitmap) {
4453 Scheduler::register_task (10 , &fake_workload);
4554 EXPECT_EQ (Scheduler::free_bitmap_, 0xFFFF'FFFE );
You can’t perform that action at this time.
0 commit comments