Utilities

urca.cpu.utilities.get_dtype(word_size: int) dtype

Return the minimum size dtype.

This function returns the minimum size dtype object that can contain the word size. This is useful for those ciphers having a non-power-of-2 word size (e.g. Speck 48/96).

Parameters:

word_size (int) – the size of the word in bits

Returns:

the numpy dtype object of the minimum size

Return type:

np.dtype

Examples

>>> from urca.utilities import get_dtype
>>> get_dtype(24)
dtype('uint32')