Implementation of name mangling algorithm.
This has to ensure that file names are unique among all files in an iso directory. Current implementation can be improved by using a hash table to keep the names, instead of iterate over all children. An alternative method, keeping children sorted all the time, thus allowing binary search, has been considered but discarded. Current implementation support up to 9,999,999 equal files per directory.
This commit is contained in:
@ -27,6 +27,15 @@ int round_up(int n, int mul)
|
||||
return div_up(n, mul) * mul;
|
||||
}
|
||||
|
||||
int int_pow(int base, int power)
|
||||
{
|
||||
int result = 1;
|
||||
while (--power >= 0) {
|
||||
result *= base;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a str in a specified codeset to WCHAR_T.
|
||||
* The result must be free() when no more needed
|
||||
|
Reference in New Issue
Block a user