I was reading some random code on the net and had come across this code snippet at following link.
#define NETDEV_ALIGN 32
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
static inline void *netdev_priv(struct net_device *dev)
{ return (char *)dev + ((sizeof(struct net_device)+
NETDEV_ALIGN_CONST)
& ~NETDEV_ALIGN_CONST);
}
The above code is somehow calculating some alignment requirement I was a bit confused on how it is being done.
Always friendly wikipedia answered my queries here
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment