aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_cpu_internal.h
blob: 664e2df5dea2d51647c7474bc0778d375f92213c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright (c) 2015, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef ODP_CPU_INTERNAL_H_
#define ODP_CPU_INTERNAL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/cpu.h>

static inline
uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1)
{
	if (odp_likely(c2 >= c1))
		return c2 - c1;

	return c2 + (odp_cpu_cycles_max() - c1) + 1;
}

#ifdef __cplusplus
}
#endif

#endif