3ndal1s
Members-
Posts
2 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
3ndal1s's Achievements
Newbie (1/3)
0
Reputation
-
i'm adding here the results of my research on operator precedence: 1.-> selection of a member of the pointed variable 2.* pointer dereference 3.(typeID) casting in C-style 4.<< bitwise left shift 5.|= bitwise OR and assignment
-
Hello i'm a C++ newbie and i am starting my exploration of mangos sourcecode. The first files i tried to read have been some /libmpq/ sources, huffman.cpp in particular. I don't really understand a statement in that file, can someone explain it to me with some patience? The line of interest lies within a function called libmpq_huff_get_8bits: static unsigned long libmpq_huff_get_8bits(struct huffman_input_stream *is) { unsigned long one_byte; if (is->bits <= 8) { is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; is->in_buf += sizeof(unsigned short); is->bits += 16; } one_byte = (is->bit_buf & 0xFF); is->bit_buf >>= 8; is->bits -= 8; return one_byte; } this function takes on a huffman_input_stream * pointer as a parameter. This struct is declared in huffman.h as it follows: struct huffman_input_stream { unsigned char *in_buf; /* 00 - Input data */ unsigned long bit_buf; /* 04 - Input bit buffer */ unsigned int bits; /* 08 - Number of bits remaining in 'byte' */ }; so now let's get to the point i'm missing: is->bit_buf |= *(unsigned short *)is->in_buf << is->bits; What does this line do exactly? Anticipated thanks for the ones who will answer me and my apologies if i committed any mistakes in posting this question here.
Contact Us
To contact us
click here
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
Copyright © getMaNGOS. All rights Reserved.
This website is in no way associated with or endorsed by Blizzard Entertainment®
This website is in no way associated with or endorsed by Blizzard Entertainment®