Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / pdisk / bitfield.h
blob5086f6b7906b9e74210ce997106d78bb6918c501
1 //
2 // bitfield.h - extract and set bit fields
3 //
4 // Written by Eryk Vershen
5 //
6 // Bitfields are not particularly transportable between big and little
7 // endian machines. Big endian machines lay out bitfields starting
8 // from the most significant bit of the (one, two or four byte) number,
9 // whereas little endian machines lay out bitfields starting from the
10 // least signifcant bit.
12 // These routines were written to support some bitfields in a disk
13 // data structure (partition map) whose original definition was on
14 // a big-endian machine.
16 // They only work on 32-bit values because I didn't need 16-bit support.
17 // The bits in the long word are numbered from 0 (least significant) to
18 // 31 (most significant).
22 * Copyright 1996,1998 by Apple Computer, Inc.
23 * All Rights Reserved
25 * Permission to use, copy, modify, and distribute this software and
26 * its documentation for any purpose and without fee is hereby granted,
27 * provided that the above copyright notice appears in all copies and
28 * that both the copyright notice and this permission notice appear in
29 * supporting documentation.
31 * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
32 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33 * FOR A PARTICULAR PURPOSE.
35 * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
36 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
38 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
39 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42 #ifndef __bitfield__
43 #define __bitfield__
47 // Defines
52 // Types
57 // Global Constants
62 // Global Variables
67 // Forward declarations
69 unsigned long bitfield_set(unsigned long *bf, int base, int length, unsigned long value);
70 unsigned long bitfield_get(unsigned long bf, int base, int length);
72 #endif /* __bitfield__ */