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

Cannot cast and/or pass bigint type inside [ ] #13

Open
GothicChessInventor opened this issue Apr 3, 2024 · 1 comment
Open

Cannot cast and/or pass bigint type inside [ ] #13

GothicChessInventor opened this issue Apr 3, 2024 · 1 comment

Comments

@GothicChessInventor
Copy link

Using Visual Studio C/C++

Trying to compute large factorials and permutation for n-th lexograohic permutation of arrays/strings.

Code segment:

memmove(buffer, digits, length * sizeof(element_t));

for (i = 0; i < length - 1; i++)
{
    scale /= (permutation_t)(length - i);
    d = index / scale;
    index %= scale;
    z = to_bigint(0);
    if (d > z) 
    {
        bigger_i = to_bigint(i);
        c = buffer[d + bigger_i];
        memmove(buffer + i + 1, buffer + i, smaller_d * sizeof(element_t));
        buffer[i] = c;
    }
}

Fails inside c = buffer[] line of code.

Severity Code Description Project File Line Suppression State
Error C2677 binary '[': no global operator found which takes type 'bigint' (or there is no acceptable conversion)

Top of code (compiles fine)

bigint permutation(element_t* const buffer,
const element_t* const digits,
const element_t length,
bigint index)
{
element_t c;
bigint d, z, scale, bigger_i;
element_t smaller_d, i;

if (!buffer || !digits || length < 1)
    return errno = EINVAL;

...

Please advise.

@GothicChessInventor
Copy link
Author

Forget it I'm going with another solution

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