offset.h revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * Copyright (C) 2000, 2001, 2004, 2007, 2016 Internet Systems Consortium, Inc. ("ISC")
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * This Source Code Form is subject to the terms of the Mozilla Public
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * License, v. 2.0. If a copy of the MPL was not distributed with this
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews/* $Id: offset.h,v 1.6 2007/06/19 23:47:20 tbox Exp $ */
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews * File offsets are operating-system dependent.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * types", so the maximum value is all 1s except for the high bit.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * This definition is more complex than it really needs to be because it was
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * crafted to keep both the SunOS 5.6 and the HP/UX 11 compilers quiet about
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * integer overflow. For example, though this is equivalent to just left
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * shifting 1 to the high bit and then inverting the bits, the SunOS compiler
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * is unhappy about shifting a positive "1" to negative in a signed integer.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein (~(((off_t)-1 >> (sizeof(off_t) * CHAR_BIT - 1)) \
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein#endif /* ISC_OFFSET_H */