diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/libresolv2/common/dnssafe/biglen.c | |
download | illumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/libresolv2/common/dnssafe/biglen.c')
-rw-r--r-- | usr/src/lib/libresolv2/common/dnssafe/biglen.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/usr/src/lib/libresolv2/common/dnssafe/biglen.c b/usr/src/lib/libresolv2/common/dnssafe/biglen.c new file mode 100644 index 0000000000..8f5ffb0a32 --- /dev/null +++ b/usr/src/lib/libresolv2/common/dnssafe/biglen.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* Copyright (C) RSA Data Security, Inc. created 1986, 1996. This is an + unpublished work protected as such under copyright law. This work + contains proprietary, confidential, and trade secret information of + RSA Data Security, Inc. Use, disclosure or reproduction without the + express written authorization of RSA Data Security, Inc. is + prohibited. + */ + +#include "port_before.h" +#include "global.h" +#include "bigmath.h" +#include "port_after.h" + +unsigned int BigLen (a, n) +UINT2 *a; +unsigned int n; +{ + UINT2 signWord = ((a[n-1] & 0x8000) ? ~0 : 0); + int i, j; + unsigned int k; + + for (i = n-1; i >= 0 && a[i] == signWord; i--); + if (i == -1) + return (1); /* len of 0 or -1 */ + + for (j = 16, k = 0x8000; + j >= 0 && 0 == (k & (signWord ^ a[i])); + j--, k >>= 1); + return (16 * i + j); +} |