tomliamlynch / androguard

Automatically exported from code.google.com/p/androguard
Apache License 2.0
0 stars 0 forks source link

In decompilation longs are represented as floating point integers #103

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In decompilation, longs are represented as floating point integers, it seems.  
For example:

calculateChecksum-BB@0x0 : 
    0       (00000000) const-wide/32        v8, 1000000 # [1000000.0]
    1       (00000006) const-wide/16        v6, 1000 # [1000.0]
    2       (0000000a) div-long             v2, v10, v8
    3       (0000000e) rem-long             v4, v10, v8
    4       (00000012) div-long/2addr       v4, v6
    5       (00000014) add-long/2addr       v2, v4
    6       (00000016) rem-long             v4, v10, v6
    7       (0000001a) add-long/2addr       v2, v4
    8       (0000001c) div-long             v4, v12, v8
...

Decompiles to:

    private static long calculateChecksum(long p10, long p12, long p14)
    {
        return ((((((((((p10 / 1000000.0) + ((p10 % 1000000.0) / 1000.0)) + (p10 % 1000.0)) + (p12 / 1000000.0)) + ((p12 % 1000000.0) / 1000.0)) + (p12 % 1000.0)) + (p14 / 1000000.0)) + ((p14 % 1000000.0) / 1000.0)) + (p14 % 1000.0)) * 4096.0);
    }

This makes it difficult to directly use the code.  Please represent longs and 
integers as integers, as many languages take the existence of the ".0" to 
represent a floating point constant.

Original issue reported on code.google.com by drspring...@gmail.com on 18 Jan 2013 at 3:42

GoogleCodeExporter commented 8 years ago
Also, e.g.: 

37      (00000082) const-wide           v2, 4294963200 # 
[2.1219937672723869e-314]

Long represented as a float.

Original comment by drspring...@gmail.com on 18 Jan 2013 at 3:44

GoogleCodeExporter commented 8 years ago

Original comment by anthony....@gmail.com on 18 Jan 2013 at 3:45