Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sfp-plus-i2c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
sfp-plus-i2c
Commits
3baf2819
Commit
3baf2819
authored
Jan 24, 2017
by
Vincent van Beveren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed readInt in DDMI value
parent
de10b3e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
DDMIValue.java
sw/jsfp/src/nl/nikhef/sfp/ddmi/DDMIValue.java
+15
-9
No files found.
sw/jsfp/src/nl/nikhef/sfp/ddmi/DDMIValue.java
View file @
3baf2819
...
...
@@ -4,6 +4,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
nl.nikhef.sfp.ddmi.DDMIMeta.BitFieldValue
;
import
nl.nikhef.tools.Utils
;
public
class
DDMIValue
extends
DDMIElement
{
...
...
@@ -160,14 +161,15 @@ public class DDMIValue extends DDMIElement {
if
(
_length
>
4
)
throw
new
AccessException
(
"Can't interpret as integer"
);
byte
[]
d
=
readRaw
(
ctx
);
if
(
d
==
null
)
return
0
;
int
l
=
d
.
length
-
1
;
int
i
=
d
[
l
];
l
--;
while
(
l
>=
0
)
{
i
=
(
i
<<
8
)
|
(
0xFF
&
d
[
l
])
;
l
--
;
int
v
=
d
[
0
];
for
(
int
i
=
1
;
i
<
d
.
length
;
i
++
)
{
v
<<=
8
;
v
|=
0xFF
&
d
[
i
]
;
}
return
i
;
return
v
;
}
public
void
writeInt
(
DDMIContext
ctx
,
int
v
)
...
...
@@ -242,7 +244,7 @@ public class DDMIValue extends DDMIElement {
break
;
case
DECIMAL_TYPE_UNSIGNED:
baseValue
=
readInt
(
ctx
);
baseValue
=
0xFFFFFFFF
L
&
readInt
(
ctx
);
break
;
case
DECIMAL_TYPE_SIGNED:
baseValue
=
readInt
(
ctx
);
...
...
@@ -251,6 +253,10 @@ public class DDMIValue extends DDMIElement {
break
;
}
if
(
DDMIMeta
.
CONV
.
partOf
(
this
))
{
baseValue
=
DDMIMeta
.
CONV
.
of
(
this
).
apply
(
baseValue
);
}
return
baseValue
;
}
...
...
@@ -270,7 +276,7 @@ public class DDMIValue extends DDMIElement {
case
DECIMAL_TYPE_FLOAT:
case
DECIMAL_TYPE_UNSIGNED:
case
DECIMAL_TYPE_SIGNED:
return
String
.
format
(
"%f"
,
readDecimal
(
ctx
));
return
String
.
format
(
"%
.3
f"
,
readDecimal
(
ctx
));
default
:
StringBuilder
sb
=
new
StringBuilder
();
for
(
byte
b
:
readRaw
(
ctx
))
...
...
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