blob: 456553409822e3f7bf873062d307f57a40b0f643 [file] [log] [blame]
Thomas Heijligen5618d5b2022-02-19 21:17:44 +01001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2022 secunet Security Networks AG
5 * (written by Thomas Heijligen <thomas.heijligen@secunet.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
Thomas Heijligen58015c22022-04-14 13:50:55 +020018#include "platform.h"
Thomas Heijligend2174c52022-04-21 13:29:33 +020019#include "platform/swap.h"
Thomas Heijligen5618d5b2022-02-19 21:17:44 +010020
21/* convert cpu native endian to little endian */
22___return_swapped(cpu_to_le, 8)
23___return_swapped(cpu_to_le, 16)
24___return_swapped(cpu_to_le, 32)
25___return_swapped(cpu_to_le, 64)
26
27/* convert cpu native endian to big endian */
28___return_same(cpu_to_be, 8)
29___return_same(cpu_to_be, 16)
30___return_same(cpu_to_be, 32)
31___return_same(cpu_to_be, 64)
32
33/* convert little endian to cpu native endian */
34___return_swapped(le_to_cpu, 8)
35___return_swapped(le_to_cpu, 16)
36___return_swapped(le_to_cpu, 32)
37___return_swapped(le_to_cpu, 64)
38
39/* convert big endian to cpu native endian */
40___return_same(be_to_cpu, 8)
41___return_same(be_to_cpu, 16)
42___return_same(be_to_cpu, 32)
43___return_same(be_to_cpu, 64)