186368Smike/*-
286368Smike * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
386368Smike * All rights reserved.
486368Smike *
586368Smike * Redistribution and use in source and binary forms, with or without
686368Smike * modification, are permitted provided that the following conditions
786368Smike * are met:
886368Smike * 1. Redistributions of source code must retain the above copyright
986368Smike *    notice, this list of conditions and the following disclaimer.
1086368Smike * 2. Redistributions in binary form must reproduce the above copyright
1186368Smike *    notice, this list of conditions and the following disclaimer in the
1286368Smike *    documentation and/or other materials provided with the distribution.
1386368Smike *
1486368Smike * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1586368Smike * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1686368Smike * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1786368Smike * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1886368Smike * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1986368Smike * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2086368Smike * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2186368Smike * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2286368Smike * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2386368Smike * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2486368Smike * SUCH DAMAGE.
2586368Smike */
2686368Smike
2786368Smike#include <sys/cdefs.h>
2886368Smike__FBSDID("$FreeBSD$");
2986368Smike
3086368Smike#include <inttypes.h>
3186368Smike
3286368Smikeintmax_t
3386368Smikeimaxabs(intmax_t j)
3486368Smike{
3586368Smike	return (j < 0 ? -j : j);
3686368Smike}
37