-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I have been refactoring your code to change the alphabet size.
To accomplish that, I have been differentiating between the types of variables that hold the index to the T[]
array (the input string) and variables that hold the elements of the input string, like c=T[i]
.
In your code, the input string consists of byte sized elements, but my goal is to make the code easily changeable to handle wider elements and larger alphabet sizes.
In the process of this refactoring, I have encountered two inconsistent places in the code:
in sais.c: 660
if(sais_mainlcp(RA, SA, NULL, newfs, m, name, sizeof(sais_index_type), 0, 0) != 0) {...
and...
in sais.c:932
if(sais_main(RA, SA, newfs, m, name, sizeof(sais_index_type), 0) != 0) {...
The 1st parameter of the sais_main()
and sais_mainlcp()
functions is an address of the input string T
.
However, the RA
variable appears to hold an address of some element inside the Suffix Array (SA), as evidenced by the lines
in sais.c:926 and in sais.c653
RA = SA + m + newfs;
Also, the assignment in the followings lines suggests that the SA[ ]
and RA[ ]
arrays consist of elements of the same type:
in sais.c:656
in sais.c:929
RA[j--] = SA[i] - 1;
The Suffix Array SA[ ]
holds indexes to the T[ ]
array (the input string).
To accommodate e.g. a 1GB string, these indexes must be wide e.g. uint32_t
, while the elements of the T[ ]
array can be smaller, e.g.: uint8_t
or uint16_t
.
This type inconsistency generates the following compiler warning:
warning C4133: 'function sais_main()': incompatible types in 1st parameter - conversion from 'uint32_t *' to 'const uint16_t *'
Q: What is the RA[ ]
array ? What does it hold ? What is its purpose ?
Q: How to solve this warning conceptually, ...without just ignoring it ?