Skip to content

Commit ea9fe7b

Browse files
committed
added some wasm tweaks
1 parent fbcb31a commit ea9fe7b

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*.la
1414
.dirstamp
1515

16+
# Wasm files
17+
*.wasm
18+
1619
# Executables
1720
hdt2rdf
1821
hdtInfo

libhdt/src/bitsequence/BitSequence375.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,21 @@ void BitSequence375::set(const size_t i, bool val) {
157157
array = &data[0];
158158
}
159159
if(val) {
160+
#ifdef __EMSCRIPTEN__
161+
/* EDITED BY @lucafabbian, TODO: check */
162+
fprintf(stderr, "[WARN] Unsafe cast called\n");
163+
bitset((uint64_t*) &array[0], i);
164+
#else
160165
bitset(&array[0], i);
166+
#endif
161167
} else {
168+
#ifdef __EMSCRIPTEN__
169+
/* EDITED BY @lucafabbian, TODO: check */
170+
fprintf(stderr, "[WARN] Unsafe cast called\n");
171+
bitclean((uint64_t*)&array[0], i);
172+
#else
162173
bitclean(&array[0], i);
174+
#endif
163175
}
164176

165177
numbits = i>=numbits ? i+1 : numbits;
@@ -173,7 +185,13 @@ void BitSequence375::append(bool bit) {
173185

174186
bool BitSequence375::access(const size_t i) const
175187
{
188+
#ifdef __EMSCRIPTEN__
189+
/* EDITED BY @lucafabbian, TODO: check */
190+
fprintf(stderr, "[WARN] Unsafe cast called\n");
191+
return bitget((uint64_t*)array, i);
192+
#else
176193
return bitget(array, i);
194+
#endif
177195
}
178196

179197
void BitSequence375::save(ostream & out) const

libhdt/src/hdt/BasicModifiableHDT.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ BasicModifiableHDT::~BasicModifiableHDT() {
2727
}
2828

2929
void BasicModifiableHDT::createComponents() {
30+
#ifndef __EMSCRIPTEN__
3031
try{
3132
std::string dictType = spec.get("dictionary.type");
3233
std::string triplesType = spec.get("triples.type");
@@ -35,6 +36,8 @@ void BasicModifiableHDT::createComponents() {
3536
{
3637
}
3738

39+
#endif
40+
3841
// FIXME: SELECT
3942
header = new PlainHeader();
4043
dictionary = new PlainDictionary();

0 commit comments

Comments
 (0)