You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/language/types.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,10 +178,15 @@ When casting integer types to bytes of a certain size, the integer value is padd
178
178
VM numbers follow Script Number format (A.K.A. CSCriptNum), to convert VM number to bytes or the reverse, it's recommended to use helper functions for these conversions from libraries like Libauth.
179
179
:::
180
180
181
+
### Semantic Byte Casting
181
182
182
-
:::caution
183
-
When casting bytes types to integer, you should be sure that the bytes value fits inside a 64-bit signed integer, or the script will fail.
184
-
:::
183
+
Bytes to bytes casting is just semantic and can be helpful for working with `LockingBytecode` global functions which expect a specific length input. To utilize byte-padding, convert to `int` and utilize the integer padding.
184
+
185
+
#### Example
186
+
```solidity
187
+
bytes pkh = nftcommitment.split(20)[0];
188
+
bytes25 lockingBytecode = new LockingBytecodeP2PKH(bytes20(pkh)):
189
+
```
185
190
186
191
## Operators
187
192
An overview of all supported operators and their precedence is included below. Notable is a lack of exponentiation, since these operations are not supported by the underlying Bitcoin Script.
0 commit comments