chiark / gitweb /
Test universal hashing and fix bugs.
[mLib] / align.h
... / ...
CommitLineData
1/* -*-c-*-
2 *
3 * $Id: align.h,v 1.1 2003/10/12 14:44:26 mdw Exp $
4 *
5 * Pointer alignment hack
6 *
7 * (c) 2003 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the mLib utilities library.
13 *
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: align.h,v $
33 * Revision 1.1 2003/10/12 14:44:26 mdw
34 * General alignment assumptions and tweaks.
35 *
36 */
37
38#ifndef MLIB_ALIGN_H
39#define MLIB_ALIGN_H
40
41#ifdef __cplusplus
42 extern "C" {
43#endif
44
45/*----- Data structures ---------------------------------------------------*/
46
47union align {
48 int i;
49 long l;
50 double d;
51 void *p;
52 void (*f)(void *);
53 struct notexist *s;
54};
55
56/*----- Macros provided ---------------------------------------------------*/
57
58#define ALIGN(sz) do { \
59 sz += sizeof(union align) - 1; \
60 sz -= sz % sizeof(union align); \
61} while (0)
62
63/*----- That's all, folks -------------------------------------------------*/
64
65#ifdef __cplusplus
66 }
67#endif
68
69#endif