Skip to content

Commit

Permalink
bm13xx: include what you use in common.h
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny9 committed Sep 6, 2023
1 parent 8780c57 commit c1bab33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/bm1397/include/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef COMMON_H_
#define COMMON_H_

#include <stdint.h>

typedef struct __attribute__((__packed__))
{
uint8_t job_id;
Expand All @@ -13,8 +15,7 @@ static unsigned char _reverse_bits(unsigned char num)
unsigned char reversed = 0;
int i;

for (i = 0; i < 8; i++)
{
for (i = 0; i < 8; i++) {
reversed <<= 1; // Left shift the reversed variable by 1
reversed |= num & 1; // Use bitwise OR to set the rightmost bit of reversed to the current bit of num
num >>= 1; // Right shift num by 1 to get the next bit
Expand All @@ -27,8 +28,7 @@ static int _largest_power_of_two(int num)
{
int power = 0;

while (num > 1)
{
while (num > 1) {
num = num >> 1;
power++;
}
Expand Down

0 comments on commit c1bab33

Please sign in to comment.