v2.0.0
Loading...
Searching...
No Matches
fiff_byte_swap.h File Reference

Endianness swap helpers for the FIFF binary tag I/O layer (FIFF is always written big-endian on disk). More...

#include <QtGlobal>
Include dependency graph for fiff_byte_swap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  FIFFLIB
 FIFF file I/O, in-memory data structures and high-level readers/writers.

Functions

qint16 FIFFLIB::swap_short (qint16 source)
qint32 FIFFLIB::swap_int (qint32 source)
void FIFFLIB::swap_intp (qint32 *source)
qint64 FIFFLIB::swap_long (qint64 source)
void FIFFLIB::swap_longp (qint64 *source)
float FIFFLIB::swap_float (float source)
void FIFFLIB::swap_floatp (float *source)
void FIFFLIB::swap_doublep (double *source)

Detailed Description

Endianness swap helpers for the FIFF binary tag I/O layer (FIFF is always written big-endian on disk).

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

FIFF tags are stored in network (big-endian) byte order on disk while all currently supported host platforms are little-endian. FiffStream therefore funnels every scalar / array read or write through one of these tiny inline helpers, which gives both the per-value variants (swap_short, swap_int, swap_long, swap_float, swap_double) and the in-place pointer variants used when decoding densely packed matrix payloads where allocating a copy would be wasteful.

These functions intentionally mirror the swap_*() helpers in the MNE-C fiff_io.c and the numpy >i4 / >f4 dtype handling in MNE-Python so a tag written by any of the three implementations round-trips byte-for-byte through the others.

Definition in file fiff_byte_swap.h.