# marchbeta2087/strict_endianness architecture

> Architecture diagram of the GitHub repository marchbeta2087/strict_endianness, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marchbeta2087/strict_endianness
- Repository: https://github.com/marchbeta2087/strict_endianness

## Overview

Strict Endianness is a small, header-only C library for reading and writing binary values in a caller-selected byte order. Its principal workflow is to open a file or wrap a memory buffer, then read or write typed values; the I/O layer detects host endianness and swaps bytes as needed. Shared definitions provide byte swapping, endianness detection, errors, and fixed-width float types. README-documented strings, seeking, alignment, buffering, and flushing are represented within the corresponding I/O components. Source excerpts show these implementations; the README supports the broader API capabilities.

Main entry points: [`strict.h`](https://github.com/marchbeta2087/strict_endianness/blob/main/strict.h) (Unified API), [`strict_file.h`](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_file.h) (Typed file I/O), [`strict_mem.h`](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_mem.h) (Typed memory I/O), [`strict_common.h`](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_common.h) (Endian and errors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared primitives"]
  node_api["Unified API<br/>[strict.h]"]
  node_common["Endian and errors<br/>[strict_common.h]"]
  node_floats["Float types<br/>[fixed_float.h]"]
end

subgraph group_file["File I/O"]
  node_fileio["Typed file I/O<br/>[strict_file.h]"]
  node_filestore[("File stream")]
end

subgraph group_memory["Memory I/O"]
  node_memio["Typed memory I/O<br/>[strict_mem.h]"]
  node_buffer[("Caller buffer")]
end

node_caller(("C/C++ caller"))

node_caller -->|"includes"| node_api
node_api -->|"includes"| node_common
node_api -->|"includes"| node_fileio
node_api -->|"includes"| node_memio
node_fileio -->|"uses primitives"| node_common
node_common -->|"includes types"| node_floats
node_caller -->|"opens and reads/writes"| node_fileio
node_fileio -->|"reads/writes"| node_filestore
node_caller -->|"wraps and reads/writes"| node_memio
node_memio -->|"reads/writes"| node_buffer
node_memio -->|"uses primitives"| node_common

click node_api "https://github.com/marchbeta2087/strict_endianness/blob/main/strict.h"
click node_common "https://github.com/marchbeta2087/strict_endianness/blob/main/strict_common.h"
click node_floats "https://github.com/marchbeta2087/strict_endianness/blob/main/fixed_float.h"
click node_fileio "https://github.com/marchbeta2087/strict_endianness/blob/main/strict_file.h"
click node_memio "https://github.com/marchbeta2087/strict_endianness/blob/main/strict_mem.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_common,node_floats toneBlue
class node_fileio,node_filestore toneAmber
class node_memio,node_buffer toneMint
class node_caller toneIndigo
```

## Components

### Shared primitives

- [Unified API](https://github.com/marchbeta2087/strict_endianness/blob/main/strict.h): `strict.h`
- [Endian and errors](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_common.h): `strict_common.h`
- [Float types](https://github.com/marchbeta2087/strict_endianness/blob/main/fixed_float.h): `fixed_float.h`

### File I/O

- [Typed file I/O](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_file.h): `strict_file.h`
- **File stream**

### Memory I/O

- [Typed memory I/O](https://github.com/marchbeta2087/strict_endianness/blob/main/strict_mem.h): `strict_mem.h`
- **Caller buffer**

### Other components

- **C/C++ caller**

## Connections

- C/C++ caller → Unified API: includes (evidence: `README.md`)
- Unified API → Endian and errors: includes (evidence: `strict.h`)
- Unified API → Typed file I/O: includes (evidence: `strict.h`)
- Unified API → Typed memory I/O: includes (evidence: `strict.h`)
- Typed file I/O → Endian and errors: uses primitives (evidence: `strict_file.h`)
- Endian and errors → Float types: includes types (evidence: `strict_common.h`)
- C/C++ caller → Typed file I/O: opens and reads/writes (evidence: `README.md`)
- Typed file I/O → File stream: reads/writes (evidence: `strict_file.h`)
- C/C++ caller → Typed memory I/O: wraps and reads/writes (evidence: `README.md`)
- Typed memory I/O → Caller buffer: reads/writes (evidence: `strict_mem.h`)
- Typed memory I/O → Endian and errors: uses primitives (evidence: `strict_mem.h`)
