Adding Byte values inside a ARRAY

Post Reply
dvcam99
Posts: 63
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 9 times

Adding Byte values inside a ARRAY

Post by dvcam99 »

Hello together,

may someone can help me.

I would like to sum all byte values inside a string or byte array.

Ok I can do this byte to byte.

Example Byte String/ARRAY: Test_byte[5]

sum_byte_int = Test_byte[0] + Test_byte[1] + Test_byte[2]......and so on!!

But I´m looking for a more elegant way to do it.


BR

Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

stefan.erni
Valued Contributor
Posts: 279
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 59 times
Been thanked: 77 times

Re: Adding Byte values inside a ARRAY

Post by stefan.erni »

Hi Dirk

What about this way?

And make sure that the sum is not greater than the maximum value of an integer


regards

Stefan

Len_2021-12-09_12-04-37.png
Len_2021-12-09_12-04-37.png (34.73 KiB) Viewed 178 times

dvcam99
Posts: 63
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 9 times

Re: Adding Byte values inside a ARRAY

Post by dvcam99 »

Super Stefan!!

Works great!!

Many Thnaks
Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

Post Reply