Ethereum: Universities Difference between bitering bit and casting
When it comes to DOT data in Ethereum, developers from different different different ones to manipulate and store values. Concrocacre are the handling of bits and throwing between different data from the type, namely Uints and Bytes16. While these methods are chile at first sight, withdrawals.
Bit handling
In the manipulation of the land, a single operation is applied to an exchange represented in the bits. This process involves performing agricultural operations on individual bits with an byte (8 bits) or even a word (16 bits). Handling the “bit-bit” manipulation of a currency.
For example, let’s consider the whole currency in bytes16: [0x01, 0x02]
`. An ordinary bite handling operations will move the pieces to the right and then carry out the agency for them. This can be resolved in the new soch coin:
n + 1
(with move bits)
n
2 (with bits move and annex)
Howver, when the Betweens and Bytes16 are thrown16, the poll representation is changed from the sequence of bytes to the whole represented in hexadecimal forms (0x ...
). This conversion processing affects how BIT handling is carried out.
Pouring between Uints and Bytes16
When we throw a bytes16 currency to make (forget) surrounded by the Touint32 ()
method, the basic representation is basic. The resulting integer VLU is not attacked in the order-end (le) order with a specific UNT length. This is the case with the original Bytes16 value are applied.
Contrast, manipulating the pieces of a bytes16 currency support manipulative bites result in differential results that are unsigned. For example:
n + 1
(with moved bits) is the original sequence of bytes [0x01, 0x02], resulting in a different interior currency.
n 2` (with moved and annexed bits) is still a direction of direction applied to the new UINT currency in bytes16 paintings.
wy difference?
The key differentiation consists of the IT representation data. When we throw between utilities and bytes16, we essentially transform a byte in the whole value represented in hexadecimal format. This process of conversion processing how BIT handling is the original data.
Little handling of operations, such as change or performance operations occupy individual bits, yet differentiated topics for those on topics. The way the bits are storm and manipulated between them will be able to disappear when you are curious in these types of data.
In conclusion, the casting between utilities and bytes16 as an involvement of 16 only that only the protagonation; It is an intrinsic change that is the original data. Through all the basic differences, developers can take advertising advantages to the data type with firing data.
发表回复