fix: byte、short 位运算转为 int 的问题

This commit is contained in:
zhangxun 2025-06-28 10:43:03 +08:00
parent fa91550ad7
commit 5d621e06b5
6 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ public class BAndCommand implements Command {
final byte a = (byte) operandStack.pop();
// Perform the byte8 bitwise AND operation and push the result back onto the stack
operandStack.push(a & b);
operandStack.push((byte)(a & b));
return currentPC + 1;
}

View File

@ -49,7 +49,7 @@ public class BOrCommand implements Command {
final byte a = (byte) operandStack.pop();
// Perform the byte8 bitwise OR operation and push the result back onto the stack
operandStack.push(a | b);
operandStack.push((byte)(a | b));
return currentPC + 1;
}

View File

@ -49,7 +49,7 @@ public class BXorCommand implements Command {
final byte a = (byte) operandStack.pop();
// Perform the byte8 bitwise XOR operation and push the result back onto the stack
operandStack.push(a ^ b);
operandStack.push((byte)(a ^ b));
return currentPC + 1;
}

View File

@ -49,7 +49,7 @@ public class SAndCommand implements Command {
final short a = (short) operandStack.pop();
// Perform the short16 bitwise AND operation and push the result back onto the stack
operandStack.push(a & b);
operandStack.push((short)(a & b));
return currentPC + 1;
}

View File

@ -49,7 +49,7 @@ public class SOrCommand implements Command {
final short a = (short) operandStack.pop();
// Perform the short16 bitwise OR operation and push the result back onto the stack
operandStack.push(a | b);
operandStack.push((short)(a | b));
return currentPC + 1;
}

View File

@ -49,7 +49,7 @@ public class SXorCommand implements Command {
final short a = (short) operandStack.pop();
// Perform the short16 bitwise XOR operation and push the result back onto the stack
operandStack.push(a ^ b);
operandStack.push((short)(a ^ b));
return currentPC + 1;
}