mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
75b52ac25e
* Intermediate work * Allow uncompressed words * Fix * Fix tests * Add NextUncompressed, remove g.word buffer * Code simplifications, no goroutines when workers == 1 * Fix lint| * Add test for MatchPrefix * Work on patricia * Beginning of new matcher * Fuzz test for new longest match * No skip * Fixes * Fixes * More tracing * Fixes * Fixes * Change back to old FindLongestMatches * Switch to old match finder * Print mismatches * Fix * After fix * After fix * After fix * Print pointers * Fixes and tests * Print * Print * Print * More tests * Intermediate * Fix * Fix * Prints * Fix * Fix * Initialise matchStack * Compute only once * Compute only once * Switch back * Switch to old Find * Introduce sais * Switch patricia to sais * Use sais in compressor * Use sais in compressor * Remove unused code Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
28 lines
413 B
Go
28 lines
413 B
Go
package sais
|
|
|
|
/*
|
|
#include "sais.h"
|
|
#include "utils.h"
|
|
*/
|
|
import "C"
|
|
import (
|
|
"fmt"
|
|
"unsafe"
|
|
)
|
|
|
|
func Sais(data []byte, sa []int32) error {
|
|
size := C.int(len(data))
|
|
t_ptr := unsafe.Pointer(&data[0]) // source "text"
|
|
sa_ptr := unsafe.Pointer(&sa[0])
|
|
|
|
result := C.sais(
|
|
(*C.uchar)(t_ptr),
|
|
(*C.int)(sa_ptr),
|
|
size,
|
|
)
|
|
if int(result) != 0 {
|
|
return fmt.Errorf("sais returned: %d", result)
|
|
}
|
|
return nil
|
|
}
|