C++ Bit Fields

Not too many people knows about C++ Bit Fields. It make decoding binary packet  effortless.

Link to article

Example: 

struct WeirdPacket
{
   unsigned int n1 : 1;
   unsigned int n2 : 7;
   unsigned int n3 : 7;
   unsigned int n4 : 17;
};

To decode:  

WeirdPacket w;   copy(w, buffer, 4); 

Then access your fields ip1.n1 to ip1.n4 at will.

Assumption:

copy also handles endian issue.

buffer points to the begin of weird packet.

C++ Bit Fields

Graphing Calculator

I wrote this Graphing Calculator for Win using MFC a long time ago. It is free for everyone. I hope you will find it useful.

Features:

– Smart math formula recognizer
– Large number of supported functions and constants
– Multiple functions per view (up to 5)
– Multi-view support
– Range & scale support
– Color for each function & axis
– Print support
– User’s guide.
Contact me.
Graphing Calculator