File: reverse_endian.h

package info (click to toggle)
ceccomp 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,648 kB
  • sloc: ansic: 6,531; python: 1,078; makefile: 248; sh: 145
file content (27 lines) | stat: -rw-r--r-- 497 bytes parent folder | download
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
#ifndef REVERSE_ENDIAN_H
#define REVERSE_ENDIAN_H

#include "main.h"
#include <byteswap.h>
#include <linux/audit.h>
#include <stdbool.h>
#include <stdint.h>

static inline bool
need_reverse_endian (uint32_t target_scmp_arch)
{
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  return (target_scmp_arch & __AUDIT_ARCH_LE);
#else
  return !(target_scmp_arch & __AUDIT_ARCH_LE);
#endif
}

static inline void
reverse_endian (filter *f)
{
  f->code = bswap_16 (f->code);
  f->k = bswap_32 (f->k);
}

#endif