Lookup table 32 bit ints

Moderator: Benj

Post Reply
mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Lookup table 32 bit ints

Post by mnf »

The lookup table doesn't seem to work with long (32 bit) ints.
test_lut.fcfx
(9.16 KiB) Downloaded 117 times
Has a lookup table (32 bit unsigned) - and two values stored GetInt(0) (returns a ULONG) returns 64 which is the LSB of the first item stored. It obviously just returns a byte - but the docs imply if should return an int.

Martin

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Lookup table 32 bit ints

Post by LeighM »

Thanks for the spot. Yes, looks like a bug in the Arduino/AVR implementation

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Lookup table 32 bit ints

Post by LeighM »

Hi Martin,
Please try the attached, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\Components
Thanks
Leigh
Attachments
lut.fcpx
(46.56 KiB) Downloaded 123 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Lookup table 32 bit ints

Post by mnf »

Thanks Leigh,

I'll give it a try...

Martin

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Lookup table 32 bit ints

Post by mnf »

Thanks - seems to work AOK.. I've tried 16/32 bit signed and unsigned and float and all seems good..

The only gotcha I can find - is because GetInt returns an unsigned long - retrieving a signed 16 bit value to a 32 bit signed variable the result doesn't get sign extended. (so -2345 will give 63191 as a result.) - so have to use the right 'size' variable for the result.

Martin

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Lookup table 32 bit ints

Post by LeighM »

Thanks Martin

Post Reply