4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1986 by Sun Microsystems, Inc.
29 * Machine-independent versions of base conversion primitives.
30 * Routines to multiply buffers by 2**16 or 10**4. Base 10**4 buffers have
31 * b[i] < 10000, carry in and out < 65536. Base 2**16 buffers have b[i] <
32 * 65536, carry in and out < 10000. If n is positive, b[0]..b[n-1] are
33 * processed; if n is negative, b[0]..b[n+1] are processed.
41 /* Converts t < 10000 into four ascii digits at *pc. */
69 /* Multiply base-2**16 buffer by 10000. */
71 register unsigned carry
, t
;
73 register unsigned *pb
;
80 *pb
= (t
= (*pb
* 10000) + carry
) & 0xffff;
88 *pb
= (t
= (*pb
* 10000) + carry
) & 0xffff;
103 /* Multiply base-10**4 buffer by 65536. */
105 register unsigned carry
, t
;
106 register short int i
;
107 register unsigned *pb
;
114 *pb
= (t
= (*pb
<< 16) | carry
) % 10000;
122 *pb
= (t
= (*pb
<< 16) | carry
) % 10000;