Adding 2 byte arrays (6 bytes each ) -any specific API available
hi friends
I m fixed up with a problem .
i want to add to arrays of six bytes each .
how can i go for this .
is there any specific API available for the same.
current method i m using is an function which add first bytes of 2 arrays and then check out if the added value is more then FF its incerments the previous bytes and then start adding the second bytes .
but its a very time consuming way .
is there any specific API available ...... to solve out this problem in a much easier way
# 2
> i want to add to arrays of six bytes each .
Looks like you want to add two 48bit numbers, right?
> how can i go for this .
> is there any specific API available for the same.
No. only 8bit and 16bit number operations are supported (and theoretical 32bit operations).
> current method i m using is an function which add
> first bytes of 2 arrays and then check out if the
> added value is more then FF its incerments the
> previous bytes and then start adding the second
> bytes .
Sounds like the paper & pencil addition method.
> but its a very time consuming way.
That is a common problem when building "large number arithmetic" functions by using 8bit operations.
From my point of view the only possibility for speeding up your algorithm is using nytes instead of shorts as usually the JavaCard processors are 8bit processors and therefore short/16bit operations are already decomposed into several 8bit operations. The only problem can be that java does not have a carry bit or an number overflow error for detecting if a number gets greater than 0xFF.
Jan