geopm
3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
libgeopmd
include
geopm_field.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 - 2024 Intel Corporation
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
6
#ifndef GEOPM_FIELD_H_INCLUDE
7
#define GEOPM_FIELD_H_INCLUDE
8
#include <stdint.h>
9
#include <string.h>
10
11
#include "
geopm_public.h
"
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
24
static
inline
uint64_t geopm_signal_to_field(
double
signal)
25
{
26
uint64_t result;
27
static_assert(
sizeof
result ==
sizeof
signal,
28
"geopm_signal_to_field requires that signals and fields are the same size"
);
29
memcpy(&result, &signal,
sizeof
(result));
30
return
result;
31
}
32
39
static
inline
double
geopm_field_to_signal(uint64_t field)
40
{
41
double
result;
42
static_assert(
sizeof
result ==
sizeof
field,
43
"geopm_field_to_signal requires that signals and fields are the same size"
);
44
memcpy(&result, &field,
sizeof
(result));
45
return
result;
46
}
47
48
#ifdef __cplusplus
49
}
50
#endif
51
#endif
geopm_public.h
Generated by
1.9.1