Commit bb776d7b authored by Kristof Szabados's avatar Kristof Szabados
Browse files

minor simplification.


Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent f2cd9ff2
...@@ -1011,12 +1011,10 @@ int BITSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& mylea ...@@ -1011,12 +1011,10 @@ int BITSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& mylea
myleaf.must_free = FALSE; myleaf.must_free = FALSE;
myleaf.data_ptr_used = TRUE; myleaf.data_ptr_used = TRUE;
myleaf.body.leaf.data_ptr = val_ptr->bits_ptr; myleaf.body.leaf.data_ptr = val_ptr->bits_ptr;
boolean orders = FALSE; boolean orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders;
myleaf.coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB; myleaf.coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders;
myleaf.coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB; myleaf.coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB;
myleaf.coding_par.csn1lh = p_td.raw->csn1lh; myleaf.coding_par.csn1lh = p_td.raw->csn1lh;
...@@ -1046,12 +1044,10 @@ int BITSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ...@@ -1046,12 +1044,10 @@ int BITSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff,
clean_up(); clean_up();
init_struct(decode_length); init_struct(decode_length);
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_LSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -609,12 +609,10 @@ int BOOLEAN::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ...@@ -609,12 +609,10 @@ int BOOLEAN::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff,
else if (decode_length == 0) boolean_value = FALSE; else if (decode_length == 0) boolean_value = FALSE;
else { else {
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -1580,12 +1580,10 @@ int CHARSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, ...@@ -1580,12 +1580,10 @@ int CHARSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td,
decode_length = ((limit > (int) buff.unread_len_bit() ? (int)buff.unread_len_bit() : limit) / 8) * 8; decode_length = ((limit > (int) buff.unread_len_bit() ? (int)buff.unread_len_bit() : limit) / 8) * 8;
} }
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -791,12 +791,10 @@ int FLOAT::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ...@@ -791,12 +791,10 @@ int FLOAT::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff,
double tmp = 0.0; double tmp = 0.0;
unsigned char data[16]; unsigned char data[16];
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -805,12 +805,10 @@ int HEXSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ...@@ -805,12 +805,10 @@ int HEXSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff,
? (int)buff.unread_len_bit() : limit) / 4) * 4; ? (int)buff.unread_len_bit() : limit) / 4) * 4;
} }
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -1420,12 +1420,10 @@ int INTEGER::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, ...@@ -1420,12 +1420,10 @@ int INTEGER::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff,
int prepaddlength = buff.increase_pos_padd(p_td.raw->prepadding); int prepaddlength = buff.increase_pos_padd(p_td.raw->prepadding);
limit -= prepaddlength; limit -= prepaddlength;
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -1255,12 +1255,10 @@ int OCTETSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td, ...@@ -1255,12 +1255,10 @@ int OCTETSTRING::RAW_decode(const TTCN_Typedescriptor_t& p_td,
? (int)buff.unread_len_bit() : limit) / 8) * 8; ? (int)buff.unread_len_bit() : limit) / 8) * 8;
} }
RAW_coding_par cp; RAW_coding_par cp;
boolean orders = FALSE; boolean orders = p_td.raw->bitorderinoctet == ORDER_MSB;
if (p_td.raw->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.bitorder = orders ? ORDER_MSB : ORDER_LSB; cp.bitorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = p_td.raw->byteorder == ORDER_MSB;
if (p_td.raw->byteorder == ORDER_MSB) orders = TRUE;
if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders; if (p_td.raw->bitorderinfield == ORDER_MSB) orders = !orders;
cp.byteorder = orders ? ORDER_MSB : ORDER_LSB; cp.byteorder = orders ? ORDER_MSB : ORDER_LSB;
cp.fieldorder = p_td.raw->fieldorder; cp.fieldorder = p_td.raw->fieldorder;
......
...@@ -157,7 +157,6 @@ const unsigned char BitMaskTable[9]={ ...@@ -157,7 +157,6 @@ const unsigned char BitMaskTable[9]={
RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par, RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par,
RAW_enc_tr_pos *par_pos, int my_pos, const TTCN_RAWdescriptor_t *raw_attr) RAW_enc_tr_pos *par_pos, int my_pos, const TTCN_RAWdescriptor_t *raw_attr)
{ {
boolean orders = FALSE;
isleaf = is_leaf; isleaf = is_leaf;
must_free = FALSE; must_free = FALSE;
data_ptr_used = FALSE; data_ptr_used = FALSE;
...@@ -182,11 +181,10 @@ RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par, ...@@ -182,11 +181,10 @@ RAW_enc_tree::RAW_enc_tree(boolean is_leaf, RAW_enc_tree *par,
ext_bit = raw_attr->extension_bit; ext_bit = raw_attr->extension_bit;
top_bit_order = raw_attr->top_bit_order; top_bit_order = raw_attr->top_bit_order;
calc = CALC_NO; calc = CALC_NO;
if (raw_attr->byteorder == ORDER_MSB) orders = TRUE; boolean orders = raw_attr->byteorder == ORDER_MSB;
if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders; if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders;
coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB; coding_par.byteorder = orders ? ORDER_MSB : ORDER_LSB;
orders = FALSE; orders = raw_attr->bitorderinoctet == ORDER_MSB;
if (raw_attr->bitorderinoctet == ORDER_MSB) orders = TRUE;
if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders; if (raw_attr->bitorderinfield == ORDER_MSB) orders = !orders;
coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB; coding_par.bitorder = orders ? ORDER_MSB : ORDER_LSB;
coding_par.hexorder = raw_attr->hexorder; coding_par.hexorder = raw_attr->hexorder;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment