Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 12-01-2012, 01:54 AM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Mar 2009
Location: hydrabad
Posts: 8
Default not understanding the array declaration along with macro


hi
here is the code , can any one plzzz explain the below code.

Code:

static const unsigned char BitsSetTable256[256] = 
{
#   define B2(n) n,     n+1,     n+1,     n+2
#   define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
#   define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
    B6(0), B6(1), B6(1), B6(2)
};
priyaranjan is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 16-01-2012, 11:00 PM   #2 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: not understanding the array declaration along with macro

hmm, how to explain...
see,
for first element B6(0)
B6(0)=B4(0), B4(1), B4(1), B4(2)=B2(0), B2(1), B2(1), B2(2),........
=0, 1, 1, 2, 1, 2, 2, 3,.........

similarly for B6(1), B6(1) and B6(2)
so all of it comes down to
static const unsigned char BitsSetTable256[256] = { 0, 1, 1, 2, 1, 2, 2, 3,........};
which is a way to initialize an array.
__________________
Arch Linux is kind of a bonzai tree, over years u try new things, make small tweaks, and end up with a system that is unique, elegant, and does exactly what u designed it to do.
Hostapd : The Linux Way to create Virtual Wifi Access Point
My Blog
nims11 is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2