Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#54 Fixed offsets for Column format detection #75

Merged

Commits on Dec 3, 2020

  1. epam#54 Fixed offsets for Column format detection

    It looks like `SasFileParser.FormatAndLabelSubheader.processSubheader` and and `SasFileConstants`
    files should use another offsets to calculate column format information correctly for x64 bitness.
    
    Before a fix:
    ```java
    long COLUMN_FORMAT_WIDTH_OFFSET = 8L;
    long COLUMN_FORMAT_PRECISION_OFFSET = 10L;
    
    subheaderOffset + COLUMN_FORMAT_WIDTH_OFFSET + intOrLongLength,
    subheaderOffset + COLUMN_FORMAT_PRECISION_OFFSET + intOrLongLength,
    ```
    
    For 32-bit:
    COLUMN_FORMAT_WIDTH_OFFSET + intOrLongLength = 8 + 4 = 12 (correct)
    COLUMN_FORMAT_PRECISION_OFFSET + intOrLongLength = 10 + 4 = 14 (correct)
    
    For 64-bit:
    COLUMN_FORMAT_WIDTH_OFFSET + intOrLongLength = 8 + 8 = 16 (not correct)
    COLUMN_FORMAT_PRECISION_OFFSET + intOrLongLength = 10 + 8 = 18 (not correct)
    
    After the fix:
    ```java
    long COLUMN_FORMAT_WIDTH_OFFSET = 0L;
    long COLUMN_FORMAT_PRECISION_OFFSET = 2L;
    
    subheaderOffset + COLUMN_FORMAT_PRECISION_OFFSET + 3 * intOrLongLength,
    subheaderOffset + COLUMN_FORMAT_TEXT_SUBHEADER_INDEX_OFFSET + 3 * intOrLongLength,
    ```
    
    For 32-bit:
    COLUMN_FORMAT_WIDTH_OFFSET + 3 * intOrLongLength = 0 + 3 * 4 = 12 (correct and the same as above)
    COLUMN_FORMAT_PRECISION_OFFSET + 3 * intOrLongLength = 2 + 3 * 4 = 14 (correct and the same as above)
    
    For 64-bit:
    COLUMN_FORMAT_WIDTH_OFFSET + 3 *intOrLongLength = 0 + 3 * 8 = 24 (correct)
    COLUMN_FORMAT_PRECISION_OFFSET + 3 * intOrLongLength = 2 + 3 * 8 = 26 (correct)
    
    So, this new calculation gives exactly the same offsets for 32-bit files and also fixes it for 64-bit files.
    xantorohara committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    be12344 View commit details
    Browse the repository at this point in the history