mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
Another # this will print 1, 2, 3, 4 -> # this will print 1, 2, 3 + "will extract modify" -> "will modify"
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user