1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/make-logtab Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +#!/usr/bin/perl 1.5 + 1.6 +# 1.7 +# make-logtab 1.8 +# 1.9 +# Generate a table of logarithms of 2 in various bases, for use in 1.10 +# estimating the output sizes of various bases. 1.11 + 1.12 +# This Source Code Form is subject to the terms of the Mozilla Public 1.13 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.14 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.15 + 1.16 +$ARRAYNAME = $ENV{'ARRAYNAME'} || "s_logv_2"; 1.17 +$ARRAYTYPE = $ENV{'ARRAYTYPE'} || "float"; 1.18 + 1.19 +printf("const %s %s[] = {\n %0.9ff, %0.9ff, ", 1.20 + $ARRAYTYPE, $ARRAYNAME, 0, 0); 1.21 +$brk = 2; 1.22 +for($ix = 2; $ix < 64; $ix++) { 1.23 + printf("%0.9ff, ", (log(2)/log($ix))); 1.24 + $brk = ($brk + 1) & 3; 1.25 + if(!$brk) { 1.26 + printf(" /* %2d %2d %2d %2d */\n ", 1.27 + $ix - 3, $ix - 2, $ix - 1, $ix); 1.28 + } 1.29 +} 1.30 +printf("%0.9ff\n};\n\n", (log(2)/log($ix))); 1.31 + 1.32 +exit 0;