PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_comp_sparc.h
Go to the documentation of this file.
1/*
2 * Sparc 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_SPARC_H__
25#define __PFMLIB_COMP_SPARC_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 __sparc__
32#error "you should not be including this file"
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39static inline unsigned long
40pfmlib_popcnt(unsigned long v)
41{
42 unsigned long sum = 0;
43
44 for(; v ; v >>=1) {
45 if (v & 0x1) sum++;
46 }
47 return sum;
48}
49
50#ifdef __cplusplus /* extern C */
51}
52#endif
53
54#endif /* __PFMLIB_COMP_SPARC_H__ */
#define pfmlib_popcnt