Python — Time complexity of built-in functions versus manually-built functions in finite fields
Generally, I’m wondering about the advantages versus disadvantages of using the built-in arithmetic functions versus rolling your own in Python.
Python — Time complexity of built-in functions versus manually-built functions in finite fields
Generally, I’m wondering about the advantages versus disadvantages of using the built-in arithmetic functions versus rolling your own in Python.
How to get from 1 byte to 2 bytes
We have 1 byte
, which is 8 bits
, which is 2^8
. Now 2 bytes
should be 2 * 1 byte
, which is 2 * 2^8 = 2^9
, but actually 2 bytes is 2^16
. What am I missing here? It seems like 2 bytes
isn’t 2 * 1 byte
, it’s more like 1 byte * 1 byte
, but this should give you byte^2
, which doesn’t make sense.
How to get from 1 byte to 2 bytes
We have 1 byte
, which is 8 bits
, which is 2^8
. Now 2 bytes
should be 2 * 1 byte
, which is 2 * 2^8 = 2^9
, but actually 2 bytes is 2^16
. What am I missing here? It seems like 2 bytes
isn’t 2 * 1 byte
, it’s more like 1 byte * 1 byte
, but this should give you byte^2
, which doesn’t make sense.
How to get from 1 byte to 2 bytes
We have 1 byte
, which is 8 bits
, which is 2^8
. Now 2 bytes
should be 2 * 1 byte
, which is 2 * 2^8 = 2^9
, but actually 2 bytes is 2^16
. What am I missing here? It seems like 2 bytes
isn’t 2 * 1 byte
, it’s more like 1 byte * 1 byte
, but this should give you byte^2
, which doesn’t make sense.
How to get from 1 byte to 2 bytes
We have 1 byte
, which is 8 bits
, which is 2^8
. Now 2 bytes
should be 2 * 1 byte
, which is 2 * 2^8 = 2^9
, but actually 2 bytes is 2^16
. What am I missing here? It seems like 2 bytes
isn’t 2 * 1 byte
, it’s more like 1 byte * 1 byte
, but this should give you byte^2
, which doesn’t make sense.
How to get from 1 byte to 2 bytes
We have 1 byte
, which is 8 bits
, which is 2^8
. Now 2 bytes
should be 2 * 1 byte
, which is 2 * 2^8 = 2^9
, but actually 2 bytes is 2^16
. What am I missing here? It seems like 2 bytes
isn’t 2 * 1 byte
, it’s more like 1 byte * 1 byte
, but this should give you byte^2
, which doesn’t make sense.
Using Power of 2 numbers to represent types
Let’s say that we have some values, represented by power of 2:
Using Power of 2 numbers to represent types
Let’s say that we have some values, represented by power of 2:
Using Power of 2 numbers to represent types
Let’s say that we have some values, represented by power of 2: