Use bitfields to make channel_hash_key struct fit into one word.

svn path=/trunk/; revision=40683
This commit is contained in:
Martin Mathieson 2012-01-24 03:05:21 +00:00
parent e36b1c6daf
commit 13316398dd
1 changed files with 8 additions and 5 deletions

View File

@ -47,6 +47,8 @@
/* TODO:
- add intermediate results to segments leading to final reassembly
- use multiple active rlc_channel_reassembly_info's per channel
- sequence analysis gets confused when we change cells and skip back
to SN 0. Maybe add cell-id to context and add to channel/result key?
*/
/********************************/
@ -322,10 +324,10 @@ static guint16 s_lengths[MAX_RLC_SDUS];
/* Channel key */
typedef struct
{
guint16 ueId;
guint16 channelType;
guint16 channelId;
guint8 direction;
unsigned ueId : 16;
unsigned channelType : 3;
unsigned channelId : 5;
unsigned direction : 1;
} channel_hash_key;
@ -804,6 +806,8 @@ static gint rlc_channel_equal(gconstpointer v, gconstpointer v2)
const channel_hash_key* val2 = v2;
/* All fields must match */
/* N.B. Currently fits into one word, so could return (*v == *v2)
if we're sure they're initialised to 0... */
return ((val1->ueId == val2->ueId) &&
(val1->channelType == val2->channelType) &&
(val1->channelId == val2->channelId) &&
@ -882,7 +886,6 @@ static gpointer get_report_hash_key(guint16 SN, guint32 frameNumber,
/* Add to the tree values associated with sequence analysis for this frame */
static void addChannelSequenceInfo(sequence_analysis_report *p,
gboolean isControlFrame,