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