fork(1) download
  1.  
  2. #define BITMASK(b7, b6, b5, b4, b3, b2, b1, b0) \
  3. b7 << 7 | b6 << 6 | b5 << 5 | b4 << 4 | \
  4. b3 << 3 | b2 << 2 | b1 << 1 | b0 << 0
  5.  
  6. bool add_block(cmem& mem, uint8* data, int size) {
  7. mem.push(data, size);
  8. return true;
  9. }
  10.  
  11. // ---- XOR -----
  12. //Example: xor ax, ax
  13. int _XOR_R(cmem& mem, uint8 reg) {
  14. uint8 op = BITMASK(0, 0, 1, 1, 0, 0, 0, 1);
  15. uint8 modrm = BITMASK(1, 1, 0, 0, 0, 0, 0, 0);
  16. uint16 opcode = (op << 7) | modrm;
  17. add_block(mem, (uint8 *)&opcode, 2);
  18. return 2;
  19. }
  20.  
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:16: error: ‘cmem’ was not declared in this scope
 bool add_block(cmem& mem, uint8* data, int size) {
                ^~~~
prog.cpp:6:22: error: ‘mem’ was not declared in this scope
 bool add_block(cmem& mem, uint8* data, int size) {
                      ^~~
prog.cpp:6:27: error: ‘uint8’ was not declared in this scope
 bool add_block(cmem& mem, uint8* data, int size) {
                           ^~~~~
prog.cpp:6:34: error: ‘data’ was not declared in this scope
 bool add_block(cmem& mem, uint8* data, int size) {
                                  ^~~~
prog.cpp:6:40: error: expected primary-expression before ‘int’
 bool add_block(cmem& mem, uint8* data, int size) {
                                        ^~~
prog.cpp:6:48: error: expression list treated as compound expression in initializer [-fpermissive]
 bool add_block(cmem& mem, uint8* data, int size) {
                                                ^
prog.cpp:13:12: error: ‘cmem’ was not declared in this scope
 int _XOR_R(cmem& mem, uint8 reg) {
            ^~~~
prog.cpp:13:18: error: ‘mem’ was not declared in this scope
 int _XOR_R(cmem& mem, uint8 reg) {
                  ^~~
prog.cpp:13:23: error: ‘uint8’ was not declared in this scope
 int _XOR_R(cmem& mem, uint8 reg) {
                       ^~~~~
prog.cpp:13:32: error: expression list treated as compound expression in initializer [-fpermissive]
 int _XOR_R(cmem& mem, uint8 reg) {
                                ^
stdout
Standard output is empty