Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 16ビット上位/下位入れ替え
- int swap_bit(uint16_t x)
- {
- uint16_t u_bit = 0x0; // 上位ビット
- uint16_t l_bit = 0x0; // 下位ビット
- uint16_t swap_b = 0x0; // 上位,下位ビット入れ替え格納
- // 上位ビット取得 8ビット右シフト
- u_bit = x >> 8;
- // 下位ビット取得 論理積
- l_bit = x & 0x00FF;
- // 上位,下位入れ替え
- swap_b = (db << 8) | ub;
- // ビット入れ替え反映
- return(swap_b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement