1212839Sbrian/*- 2212839Sbrian * Copyright (c) 1999 Marcel Moolenaar 3212839Sbrian * All rights reserved. 4212839Sbrian * 5212839Sbrian * Redistribution and use in source and binary forms, with or without 6212839Sbrian * modification, are permitted provided that the following conditions 7212839Sbrian * are met: 8212839Sbrian * 1. Redistributions of source code must retain the above copyright 9212839Sbrian * notice, this list of conditions and the following disclaimer 10212839Sbrian * in this position and unchanged. 11212839Sbrian * 2. Redistributions in binary form must reproduce the above copyright 12212839Sbrian * notice, this list of conditions and the following disclaimer in the 13212839Sbrian * documentation and/or other materials provided with the distribution. 14212839Sbrian * 3. The name of the author may not be used to endorse or promote products 15212839Sbrian * derived from this software without specific prior written permission. 16212839Sbrian * 17212839Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18212839Sbrian * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19212839Sbrian * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20212839Sbrian * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21212839Sbrian * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22212839Sbrian * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23212839Sbrian * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24212839Sbrian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25212839Sbrian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26212839Sbrian * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27212839Sbrian * 28212839Sbrian * $FreeBSD: releng/11.0/sys/sys/assym.h 126891 2004-03-12 21:45:33Z trhodes $ 29212839Sbrian */ 30212839Sbrian 31212839Sbrian#ifndef _SYS_ASSYM_H_ 32212839Sbrian#define _SYS_ASSYM_H_ 33212839Sbrian 34212839Sbrian#define ASSYM_BIAS 0x10000 /* avoid zero-length arrays */ 35212839Sbrian#define ASSYM_ABS(value) ((value) < 0 ? -((value) + 1) + 1ULL : (value)) 36212839Sbrian 37212839Sbrian#define ASSYM(name, value) \ 38212839Sbrianchar name ## sign[((value) < 0 ? 1 : 0) + ASSYM_BIAS]; \ 39212839Sbrianchar name ## w0[(ASSYM_ABS(value) & 0xFFFFU) + ASSYM_BIAS]; \ 40212839Sbrianchar name ## w1[((ASSYM_ABS(value) & 0xFFFF0000UL) >> 16) + ASSYM_BIAS]; \ 41212839Sbrianchar name ## w2[((ASSYM_ABS(value) & 0xFFFF00000000ULL) >> 32) + ASSYM_BIAS]; \ 42212839Sbrianchar name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS] 43212839Sbrian 44212839Sbrian#endif /* !_SYS_ASSYM_H_ */ 45212839Sbrian