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

FSEU16_MAX_MEMORY_USAGE is defined at fseU16.c not a fseU16.h #111

Open
Chemical118 opened this issue Apr 5, 2023 · 0 comments
Open

FSEU16_MAX_MEMORY_USAGE is defined at fseU16.c not a fseU16.h #111

Chemical118 opened this issue Apr 5, 2023 · 0 comments

Comments

@Chemical118
Copy link

When I test the FSE-16bit version, I found some issue about the FSE_MAX_MEMORY_USAGE.
This is the code I tested.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "fseU16.h"

int main() {
    // Change the FSEU16_MAX_SYMBOL_VALUE to 4095
    int n = 10000, max = 4095;
    uint16_t *ip = malloc(sizeof(uint16_t) * n);
    uint8_t *op = malloc(sizeof(uint8_t) * 2 * n);

    for (int i=0; i<n; i++){
        ip[i] = i % max;
    }

    size_t compress = FSE_compressU16(op, 2 * n, ip, n, max, 0);
    printf("Code : %zd\n", compress);

    free(ip);
    free(op);
}

I include fseU16.h to use 16bit version, so I expected FSE_MAX_MEMORY_USAGE is 15.
However, FSEU16_MAX_MEMORY_USAGE is defined on this line at fseU16.c, so at this code FSE_MAX_MEMORY_USAGE is 14 by fse.h.

Before I make PR about this, I would like to ask if this is intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant