The Gaudi Framework  v30r3 (a5ef0a68)
pfmlib_comp_i386.h
Go to the documentation of this file.
1 /*
2  * I386 P6/Pentium M compiler specific macros
3  *
4  * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
5  * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11  * of the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef __PFMLIB_COMP_I386_P6_H__
25 #define __PFMLIB_COMP_I386_P6_H__
26 
27 #ifndef __PFMLIB_COMP_H__
28 #error "you should never include this file directly, use pfmlib_comp.h"
29 #endif
30 
31 #ifndef __i386__
32 #error "you should not be including this file"
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 static inline unsigned long pfmlib_popcnt( unsigned long v )
40 {
41  unsigned long sum = 0;
42 
43  for ( ; v; v >>= 1 ) {
44  if ( v & 0x1 ) sum++;
45  }
46  return sum;
47 }
48 
49 #ifdef __cplusplus /* extern C */
50 }
51 #endif
52 
53 #endif /* __PFMLIB_COMP_IA64_H__ */
double sum(double x, double y, double z)