Another # this will print 1, 2, 3, 4 -> # this will print 1, 2, 3 + "will extract modify" -> "will modify"

jiw
2025-01-12 22:12:59 -07:00
parent 2eb559d7b4
commit 5f0de766b2

@@ -343,7 +343,7 @@ myfunction( array.array("l", (1,2,3,4)))
def myfunction( )->int:
int32_array = array.array("l", (1,2,3,4))
x = ptr32( int32_array )
print(x[0], x[1], x[2] ) # this will print 1, 2, 3, 4
print(x[0], x[1], x[2] ) # this will print 1, 2, 3
ba = bytearray(10)
y = ptr8(ba)
y[0] = 1 # This will change ba[0]
@@ -398,7 +398,7 @@ If x is a ptr8, x[n] will always be between 0 and 255.
* If x is a ptr16, `x[n] = v` will extract the least two significant bytes of the Viper integer `v`and modify the two byte at x[n]
* If x is a ptr32, `x[n] = v` will extract modify the four bytes at `x[n]` with the Viper integer v.
* If x is a ptr32, `x[n] = v` will modify the four bytes at `x[n]` with the Viper integer v.
In all cases you will need to convert to a Viper `int` first.