]> git.proxmox.com Git - mirror_spl.git/blame - include/sys/div64.h
Apply a nice fix caught by Ricardo,
[mirror_spl.git] / include / sys / div64.h
CommitLineData
b61a6e8b 1/*
2 * This file is part of the SPL: Solaris Porting Layer.
3 *
4 * Copyright (c) 2008 Sun Microsystems, Inc.
5 *
6 * This is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef _SPL_DIV64_H
22#define _SPL_DIV64_H
23
24#include <asm/div64.h>
25
26#ifndef HAVE_DIV64_64
27#if BITS_PER_LONG == 32
28
29extern uint64_t spl_div64_64(uint64_t dividend, uint64_t divisor);
30#define div64_64(a,b) spl_div64_64(a,b)
31
32#else /* BITS_PER_LONG == 32 */
33
34static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
35{
36 return dividend / divisor;
37}
38
39#endif /* BITS_PER_LONG == 32 */
40#endif /* HAVE_DIV64_64 */
41
42#define roundup64(x, y) (div64_64((x) + ((y) - 1), (y)) * (y))
43
44#endif /* _SPL_DIV64_H */