-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James Yean <[email protected]>
- Loading branch information
Showing
23 changed files
with
241 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule alib
updated
3 files
+1 −1 | CMakeLists.txt | |
+9 −1 | include/alib/collections/list/segarray.h | |
+16 −2 | src/collections/list/segarray.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* config.h | ||
* | ||
* @author James Yin <[email protected]> | ||
*/ | ||
#ifndef __ACTRIE_CONFIG_H__ | ||
#define __ACTRIE_CONFIG_H__ | ||
|
||
#include <stddef.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif /* __cplusplus */ | ||
|
||
typedef struct _segarray_config_ { | ||
size_t seg_blen; | ||
size_t region_size; | ||
} segarray_config_s, *segarray_config_t; | ||
|
||
segarray_config_s hint_segarray(size_t len); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif /* __cplusplus */ | ||
|
||
#endif // __ACTRIE_CONFIG_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* matcher.c | ||
* | ||
* @author James Yin <[email protected]> | ||
*/ | ||
#include "actrie/config.h" | ||
|
||
#include <stdio.h> | ||
|
||
segarray_config_s hint_segarray(size_t len) { | ||
segarray_config_s config = {.seg_blen = 0}; | ||
|
||
size_t hint = len >> 3; | ||
while (hint != 0) { | ||
hint >>= 1; | ||
config.seg_blen++; | ||
} | ||
if (config.seg_blen < 10) { | ||
config.seg_blen = 10; | ||
} | ||
|
||
config.region_size = (len >> config.seg_blen) + 1; | ||
if (config.region_size < 8) { | ||
config.region_size = 8; | ||
} | ||
|
||
fprintf(stderr, "seg_blen: %zu, region_size: %zu\n", config.seg_blen, config.region_size); | ||
|
||
return config; | ||
} |
Oops, something went wrong.