xref: /netbsd-src/bin/sh/arithmetic.h (revision 727a69dc1ddae01bac99c3a802980d673621e8b2)
1*727a69dcSkre /*	$NetBSD: arithmetic.h,v 1.2 2017/06/07 05:08:32 kre Exp $	*/
2cc8e58edSkre 
3cc8e58edSkre /*-
4cc8e58edSkre  * Copyright (c) 1995
5cc8e58edSkre  *      The Regents of the University of California.  All rights reserved.
6cc8e58edSkre  *
7cc8e58edSkre  * Redistribution and use in source and binary forms, with or without
8cc8e58edSkre  * modification, are permitted provided that the following conditions
9cc8e58edSkre  * are met:
10cc8e58edSkre  * 1. Redistributions of source code must retain the above copyright
11cc8e58edSkre  *    notice, this list of conditions and the following disclaimer.
12cc8e58edSkre  * 2. Redistributions in binary form must reproduce the above copyright
13cc8e58edSkre  *    notice, this list of conditions and the following disclaimer in the
14cc8e58edSkre  *    documentation and/or other materials provided with the distribution.
15cc8e58edSkre  * 4. Neither the name of the University nor the names of its contributors
16cc8e58edSkre  *    may be used to endorse or promote products derived from this software
17cc8e58edSkre  *    without specific prior written permission.
18cc8e58edSkre  *
19cc8e58edSkre  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20cc8e58edSkre  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21cc8e58edSkre  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22cc8e58edSkre  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23cc8e58edSkre  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24cc8e58edSkre  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25cc8e58edSkre  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26cc8e58edSkre  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27cc8e58edSkre  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28cc8e58edSkre  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29cc8e58edSkre  * SUCH DAMAGE.
30cc8e58edSkre  *
31cc8e58edSkre  *	@(#)arith.h	1.1 (Berkeley) 5/4/95
32cc8e58edSkre  *
33cc8e58edSkre  * From FreeBSD, from dash
34cc8e58edSkre  */
35cc8e58edSkre 
36cc8e58edSkre #include "shell.h"
37cc8e58edSkre 
38cc8e58edSkre #define	DIGITS(var)		(3 + (2 + CHAR_BIT * sizeof((var))) / 3)
39cc8e58edSkre 
40cc8e58edSkre #define	ARITH_FORMAT_STR	"%" PRIdMAX
41cc8e58edSkre 
42*727a69dcSkre intmax_t arith(const char *, int);
43