---
name: "pfm_regmask_set"
section: "3"
platform: "linux"
package: "libpfm3-3.2-dev"
version: "3.2.070507-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/pfm_regmask_set"
---

# pfm\_regmask\_set(3)

operations on pfmlib\_regmask\_t bitmasks

## NAME

pfm\_regmask\_set, pfm\_regmask\_isset, pfm\_regmask\_clr, pfm\_regmask\_weight, pfm\_regmask\_eq, pfm\_regmask\_and, pfm\_regmask\_or, pfm\_regmask\_copy - operations on pfmlib\_regmask\_t bitmasks

## SYNOPSIS

```
#include <perfmon/pfmlib.h>

int pfm_regmask_isset(pfmlib_regmask_t *mask,  unsigned int b);
int pfm_regmask_set(pfmlib_regmask_t *mask,  unsigned int b);
int pfm_regmask_clr(pfmlib_regmask_t *mask,  unsigned int b);
int pfm_regmask_weight(pfmlib_regmask_t *mask, unsigned int *w);
int pfm_regmask_eq(pfmlib_regmask_t *mask1, pfmlib_regmask_t *mask2);
int pfm_regmask_and(pfmlib_regmask_t *dest, pfmlib_regmask_t *m1, pmlib_regmask_t *m2);
int pfm_regmask_or(pfmlib_regmask_t *dest, pfmlib_regmask_t *m1, pmlib_regmask_t *m2);
int pfm_regmask_copy(pfmlib_regmask_t *dest, pfmlib_regmask_t *src);

```

## DESCRIPTION

This set of function is used to operate of the **pfmlib\_regmask\_t** bitmasks that are returned by certain functions or passed to **pfm\_dispatch\_events**.

To ensure portability, it is important that applications use **only** the  functions specified here to access te bitmasks. It is strongly discouraged to access the internal fields of the **pfm\_regmask\_t** structure.

The **pfm\_regmask\_set** function is used to set bit **b** in the bitmask **mask**.

The **pfm\_regmask\_clr** function is used to clear bit **b** in the bitmask **mask**.

The **pfm\_regmask\_isset** function returns a non-zero value if **b** is set in the bitmask mask**.**

**The pfm\_regmask\_weight** function returns in **w** the number of bits set in the bitmask **mask**.

The **pfm\_regmask\_eq** function returns a non-zero value if the bitmasks **mask1** and **mask2** are identical.

The **pfm\_regmask\_and** function returns in bitmask **dest** the result of the logical AND operation between bitmask **m1** and bitmask **m2**.

The **pfm\_regmask\_or** function returns in bitmask **dest** the result of the logical OR operation between bitmask **m1** and bitmask **m2**.

The **pfm\_regmask\_copy** function copies bitmask **src** into bitmask dest.

## RETURN

The function returns whether or not it was successful. A return value of **PFMLIB\_SUCCESS** indicates success,  otherwise the value is the error code.

## ERRORS

**PFMLIB\_ERR\_INVAL** the bit **b** exceeds the limit supported by the library

## AUTHOR

Stephane Eranian \<eranian@hpl.hp.com\>
