Convert 16bit 2's complement number into standard number

My maths brain has locked up

given a 2 element list [255,254] which in hex represents 0xFFFE and if we assume it's in two's complement == -2

how can I get the two's complement decimal number of any [x,y] list

The easy way:
unsigned short x=a[0]*1<<8+a[1];
short y=*(*short)&x;
The hard way:

(why don't we have pointers and explicit type conversion in snap?)

My brain started working again and I've come up with this

untitled script pic (52)

[edit] made a couple of custom reporters to tidy it up

TTS_textToSpeech_sound script pic (2)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.