Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arpad Lovassy
titan.core
Commits
a606c111
Commit
a606c111
authored
Apr 03, 2018
by
Botond Baranyi
Committed by
Gerrit Code Review
Apr 03, 2018
Browse files
Merge "Revert "Fixed RAW encoding of -2147483648 (bug 533067)""
parents
884c7041
9d97f1e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/Integer.cc
View file @
a606c111
...
...
@@ -1177,7 +1177,7 @@ int INTEGER::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf)
}
else
{
// not IntX, use the field length
length
=
(
p_td
.
raw
->
fieldlength
+
7
)
/
8
;
if
(
min_bits
(
value
,
neg_sgbit
)
>
p_td
.
raw
->
fieldlength
)
{
if
(
min_bits
(
value
)
>
p_td
.
raw
->
fieldlength
)
{
TTCN_EncDec_ErrorContext
::
error
(
TTCN_EncDec
::
ET_LEN_ERR
,
"There are insufficient bits to encode '%s' : "
,
p_td
.
name
);
value
=
0
;
// substitute with zero
...
...
core/RAW.cc
View file @
a606c111
...
...
@@ -309,16 +309,13 @@ RAW_enc_tree* RAW_enc_tree::get_node(RAW_enc_tr_pos &req_pos)
* @return the number of bits needed to represent the given integer
* in sign+magnitude
*/
int
min_bits
(
int
a
,
bool
signbit
)
int
min_bits
(
int
a
)
{
if
(
a
==
INT_MIN
)
{
return
sizeof
(
int
)
*
8
+
signbit
;
}
register
int
bits
=
0
;
register
int
tmp
=
a
;
if
(
a
<
0
)
{
bits
=
1
;
tmp
=
-
a
;
// doesn't work on INT_MIN
tmp
=
-
a
;
}
while
(
tmp
!=
0
)
{
bits
++
;
...
...
core/RAW.hh
View file @
a606c111
...
...
@@ -52,7 +52,7 @@ extern const unsigned char BitMaskTable[9];
class
RAW_enc_tree
;
struct
TTCN_Typedescriptor_t
;
struct
TTCN_TEXTdescriptor_t
;
int
min_bits
(
int
a
,
bool
signbit
);
int
min_bits
(
int
a
);
int
min_bits
(
BIGNUM
*
a
);
enum
ext_bit_t
{
EXT_BIT_NO
,
/**< No extension bit */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment