1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

8ビットの並びを逆転して遊ぶ その1

Last updated at Posted at 2025-05-08

いろいろ、注意

  • UNOでの予定は、未定

プログラム



#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    long a;
    
    a = 0b11110000;
    //a = 0b10000000;
    //a = 0b01000000;
    //a = 0b00100000;
    //a = 0b00010000;
    //a = 0b00001000;
    //a = 0b00000100;
    //a = 0b00000010;
    //a = 0b00000001;

    //printf("1[%x]\n",a);
    a = a | (a << 8);
    //printf("2[%x]\n",a);
    a = (a & 0b000110011000000 ) | ( (a << 4) & 0b011001100000000 );
    //printf("3[%x]\n",a);
    a = (a & 0b010101010000000 ) | ( (a << 2) & 0b101010100000000 );
    a = a >> 7;
    printf("[%02x]\n",a);

}


[0f]

おまけ



1234567890123456789012345
                 44332211
         44332211    <<8
        0b000111111110000      
             22114433 
        0b000110011000000       
         22114433    <<4
        0b011001100000000 
           11223344      
           badcfehg      
        0b010101010000000
         badcfehg    <<2 
        0b101010100000000
          abcdefgh      *
                 abcdefgh  >>7
                           


1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?