Skip to content
/ endian.h Public

Small cross-platform endian header for C

Notifications You must be signed in to change notification settings

finwo/endian.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

endian.h

Basic handling of endianness between host and known orientations

This library makes use of dep to manage it's dependencies and exports.

Installation

This package is in the main repository for the dep package manager, so you should be able to install it using dep add finwo/endian

API

These macros are defined in src/endian.h:

htobe16(x)
htole16(x)
be16toh(x)
le16toh(x)

htobe32(x)
htole32(x)
be32toh(x)
le32toh(x)

htobe64(x)
htole64(x)
be64toh(x)
le64toh(x)

And as a C11 extension, the following macros are defined as well in src/endian-c11.h to not have to think about the type being passed to the maco:

htobe(x)
htole(x)
betoh(x)
letoh(x)

About

Small cross-platform endian header for C

Resources

Stars

Watchers

Forks

Packages

No packages published