incorrect XOR operation #1552

Open
opened 2025-12-28 17:16:49 +00:00 by sami · 1 comment
Owner

Originally created by @Turalchik on GitHub (Aug 29, 2025).

func TestXORByte(t *testing.T) {
	src := `
		package foo
		func Main() byte {
			return ^byte(0)
		}
	`
	eval(t, src, big.NewInt(255))
}

Current Behavior

The function returns -1.

Expected Behavior

The function should return 255.

Steps to Reproduce

Reproduce the test above.

Your Environment

v0.111.0

Originally created by @Turalchik on GitHub (Aug 29, 2025). ```go func TestXORByte(t *testing.T) { src := ` package foo func Main() byte { return ^byte(0) } ` eval(t, src, big.NewInt(255)) } ``` ## Current Behavior The function returns -1. ## Expected Behavior The function should return 255. ## Steps to Reproduce Reproduce the test above. ## Your Environment v0.111.0
Author
Owner

@roman-khimov commented on GitHub (Aug 31, 2025):

There are no proper int types in VM and in our Go compiler, byte/int/int16/uint64/etc are all the same int256 effectively. At this stage this is the expected behavior.

@roman-khimov commented on GitHub (Aug 31, 2025): There are no proper int types in VM and in our Go compiler, byte/int/int16/uint64/etc are all the same int256 effectively. At this stage this is the expected behavior.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neo-go#1552
No description provided.