Skip to content

Variable

Kannagi edited this page Oct 20, 2024 · 14 revisions

You have 4 sizes for signed types : int8 int16 int32 int64
You have 4 sizes for unsigned types : uint8 uint16 uint32 uint64

For floating point numbers you have : float16 float32 float64

For vectors, it is v type x2 x4 or x8.
For example :
vint8x8 vfloat16x4 vint32x4

You can give what kind of variable you are using:
register to indicate that it is a register, you cannot make a array with it.
spm allows you to declare variables in a reserved space, all spm variables share the same address, it is defined with map.spm
lib is in the same principle, it is defined with map.lib
stack to indicate that the variable uses the stack

Example :

uint8 var,var2
spm uint16 var3,var4
lib uint32 var5,var6

register uint32 reg2,reg1

How to use it

It is not possible to initialize , so do uint8 var = 0; is not valid.
Variables have a minimum scope of a function (not possible to make a variable with a scope of an if or while for example).

All variables by default are global, there is no stack.
The variables stored in your functions will have the name function_name.myvariable;

func test:
{
	uint8 var //global name is test.var
}
Clone this wiki locally