Viet's Blog

X86

Endianness Agnostic ntoh

  • Jun 22, 2019
  • POST
From the Endianness detection blog entry, we have learned how to do that using predefined macros across different architectures. Our next task is to write ntoh (network to host) and hton (host to network) functions to convert integers and floating point values between network and host formats. Here’s a catch: Do not use conditionals - basically, do not use any of the keywords if/else/for/while. To make it even harder: Do not include any headers and also do not use #if/#else/#endif pre-processors.

Endianness Detection the Hard Way

  • Jun 17, 2018
  • POST
Recently I have had a project that involves serialisation (again!). I have written countless serialisers and deserialisers in 8 years of professional experience. As it goes with binary serialisation, you need to worry about Endianness of your machine because you want your code to be portable across multiple architectures. Text serialisations to JSON or mere CSV exempt you from all that headache, but they are too verbose and slow. In this post I will walk you through tricks to detect Endianness.
LATESTS
Make Grub Font Size Bigger
  • Sep 22, 2019
  • POST
Endianness Agnostic ntoh
  • Jun 22, 2019
  • POST
Upcoming Posts
  • Jun 15, 2019
  • POST
Taming Elementary OS
  • May 11, 2019
  • POST
Fix Wifi for Ubuntu on Microsoft Surface
  • May 11, 2019
  • POST
Endianness Detection the Hard Way
  • Jun 17, 2018
  • POST
OCaml Packaging With Topkg and OPAM
  • May 28, 2018
  • POST
Safer C++ By Handling Function Result
  • May 12, 2018
  • POST
P2P Browsing Web With Beaker and Dat
  • Mar 31, 2018
  • POST
Edit and Annotate PDF
  • Mar 30, 2018
  • POST
CATEGORIES
TAGS
  • dev
  • tips
  • ubuntu
  • hugo
  • blog
  • c++
  • config
  • git
  • security
  • social-media

© Viet's Blog

Powered by Hugo.

Robust designed by Daisuke Tsuji.