diff options
author | MITSUNARI Shigeo <[email protected]> | 2024-08-21 11:18:12 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2024-08-21 11:18:12 +0900 |
commit | 78b4407869f2d89c72cf7139c2df9a438993307d (patch) | |
tree | d122bedbf7f72186c90b59e117bf219741619094 | |
parent | aabb091ae37068498751fd58202a9854408ecb0e (diff) | |
download | xbyak-78b4407869f2d89c72cf7139c2df9a438993307d.tar.gz xbyak-78b4407869f2d89c72cf7139c2df9a438993307d.zip |
[sample] resize stack element
-rw-r--r-- | sample/bf.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sample/bf.cpp b/sample/bf.cpp index 2abb8a5..657c87c 100644 --- a/sample/bf.cpp +++ b/sample/bf.cpp @@ -30,7 +30,7 @@ public: const Reg32& pPutchar(esi); const Reg32& pGetchar(edi); const Reg32& stack(ebp); - const Address cur = dword [stack]; + const Address cur = byte [stack]; push(ebp); // stack push(esi); push(edi); @@ -42,7 +42,7 @@ public: const Reg64& pPutchar(rsi); const Reg64& pGetchar(rdi); const Reg64& stack(rbp); // stack - const Address cur = dword [stack]; + const Address cur = byte [stack]; push(rsi); push(rdi); push(rbp); @@ -53,7 +53,7 @@ public: const Reg64& pPutchar(rbx); const Reg64& pGetchar(rbp); const Reg64& stack(r12); // stack - const Address cur = dword [stack]; + const Address cur = byte [stack]; push(rbx); push(rbp); push(r12); @@ -80,7 +80,7 @@ public: case '<': { int count = getContinuousChar(is, c); - add(stack, 4 * (c == '>' ? count : -count)); + add(stack, (c == '>' ? count : -count)); } break; case '.': @@ -89,12 +89,12 @@ public: call(pPutchar); pop(eax); #elif defined(XBYAK64_WIN) - mov(ecx, cur); + movzx(ecx, cur); sub(rsp, 32); call(pPutchar); add(rsp, 32); #else - mov(edi, cur); + movzx(edi, cur); call(pPutchar); #endif break; @@ -106,13 +106,13 @@ public: call(pGetchar); add(rsp, 32); #endif - mov(cur, eax); + mov(cur, al); break; case '[': { Label B = L(); labelB.push(B); - mov(eax, cur); + movzx(eax, cur); test(eax, eax); Label F; jz(F, T_NEAR); |