in reply to Converting an array of bytes into a BigInt - speed considerations
Horner rule for evaluating a polynomial from an array of coefficients:
This algorithm is pretty efficient and needs no data tables kept.sub bytearray_to_bigint { my $result = Math::BigInt->new('0'); while (@_) { $result <<= 8; # was *= 256; $result += pop; } $result; }
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Horner Rule Re: Converting an array of bytes into a BigInt
by BrowserUk (Patriarch) on Jan 24, 2003 at 06:58 UTC |