| line |
true |
false |
branch |
|
75
|
0 |
95 |
if ((items - first) % 2 != 0) croak("%s: odd number of option arguments", who); |
|
76
|
22 |
89 |
for (int ai = first; ai + 1 < items; ai += 2) { |
|
78
|
11 |
11 |
if (strcmp(key, "wrap") == 0) { |
|
80
|
11 |
0 |
if (!SvROK(wv) || SvTYPE(SvRV(wv)) != SVt_PVAV) |
|
|
0 |
11 |
if (!SvROK(wv) || SvTYPE(SvRV(wv)) != SVt_PVAV) |
|
84
|
10 |
1 |
if (n < 2 || n > 3) croak("%s: wrap needs 2 or 3 extents", who); |
|
|
0 |
10 |
if (n < 2 || n > 3) croak("%s: wrap needs 2 or 3 extents", who); |
|
86
|
22 |
0 |
for (SSize_t i = 0; i < n; i++) { SV **e = av_fetch(av, i, 0); world[(int)i] = e ? SvNV(*e) : 0.0; } |
|
|
22 |
10 |
for (SSize_t i = 0; i < n; i++) { SV **e = av_fetch(av, i, 0); world[(int)i] = e ? SvNV(*e) : 0.0; } |
|
88
|
10 |
1 |
} else if (strcmp(key, "sphere") == 0) { |
|
90
|
7 |
3 |
if (!(*sphere > 0.0) || !isfinite(*sphere)) croak("%s: sphere radius must be finite and > 0", who); |
|
|
1 |
6 |
if (!(*sphere > 0.0) || !isfinite(*sphere)) croak("%s: sphere radius must be finite and > 0", who); |
|
114
|
24 |
69 |
const char *p = SvOK(path) ? SvPV_nolen(path) : NULL; |
|
115
|
93 |
0 |
if (max_entries > UINT32_MAX || num_buckets > UINT32_MAX) |
|
|
0 |
93 |
if (max_entries > UINT32_MAX || num_buckets > UINT32_MAX) |
|
121
|
12 |
75 |
if (!h) croak("Data::SpatialHash::Shared->new: %s", errbuf); |
|
138
|
2 |
0 |
if (max_entries > UINT32_MAX || num_buckets > UINT32_MAX) |
|
|
0 |
2 |
if (max_entries > UINT32_MAX || num_buckets > UINT32_MAX) |
|
144
|
0 |
2 |
if (!h) croak("Data::SpatialHash::Shared->new_memfd: %s", errbuf); |
|
157
|
0 |
2 |
if (!h) croak("Data::SpatialHash::Shared->new_from_fd: %s", errbuf); |
|
166
|
0 |
79 |
if (!SvROK(self)) return; |
|
168
|
0 |
79 |
if (!h) return; |
|
176
|
9 |
0 |
EXTRACT(self); |
|
|
0 |
9 |
EXTRACT(self); |
|
|
0 |
9 |
EXTRACT(self); |
|
178
|
0 |
9 |
if (sph_msync(h) != 0) croak("msync: %s", strerror(errno)); |
|
185
|
2 |
1 |
if (sv_isobject(self_or_class)) { |
|
187
|
0 |
2 |
if (!h) croak("Attempted to use a destroyed object"); |
|
190
|
0 |
1 |
if (items < 2) croak("Usage: ...->unlink($path)"); |
|
193
|
0 |
3 |
if (!p) croak("cannot unlink anonymous or memfd object"); |
|
194
|
0 |
3 |
if (unlink(p) != 0) croak("unlink(%s): %s", p, strerror(errno)); |
|
200
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
202
|
0 |
2 |
RETVAL = h->backing_fd; |
|
210
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
213
|
0 |
2 |
if (RETVAL < 0) croak("eventfd: %s", strerror(errno)); |
|
222
|
1 |
0 |
EXTRACT(self); |
|
|
0 |
1 |
EXTRACT(self); |
|
|
0 |
1 |
EXTRACT(self); |
|
224
|
1 |
0 |
if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd); |
|
|
1 |
0 |
if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd); |
|
231
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
233
|
0 |
3 |
RETVAL = h->notify_fd; |
|
241
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
243
|
2 |
0 |
RETVAL = sph_notify(h); |
|
251
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
254
|
1 |
2 |
RETVAL = (n >= 0) ? newSViv((IV)n) : &PL_sv_undef; |
|
262
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
264
|
0 |
3 |
RETVAL = h->hdr->max_entries; |
|
272
|
7 |
0 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
274
|
1 |
6 |
RETVAL = h->hdr->num_buckets; |
|
282
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
284
|
0 |
2 |
RETVAL = h->hdr->cell_size; |
|
292
|
6 |
0 |
EXTRACT(self); |
|
|
0 |
6 |
EXTRACT(self); |
|
|
0 |
6 |
EXTRACT(self); |
|
294
|
5 |
1 |
if (h->wrap) { |
|
295
|
2 |
3 |
int dims = (h->hdr->world[2] > 0.0) ? 3 : 2; |
|
296
|
5 |
0 |
EXTEND(SP, dims); |
|
|
0 |
5 |
EXTEND(SP, dims); |
|
297
|
12 |
5 |
for (int i = 0; i < dims; i++) PUSHs(sv_2mortal(newSVnv(h->hdr->world[i]))); |
|
304
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
306
|
0 |
3 |
RETVAL = h->hdr->sphere_radius; |
|
314
|
64 |
0 |
EXTRACT(self); |
|
|
0 |
64 |
EXTRACT(self); |
|
|
0 |
64 |
EXTRACT(self); |
|
316
|
49 |
15 |
RETVAL = __atomic_load_n(&h->hdr->count, __ATOMIC_ACQUIRE); |
|
324
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
326
|
1 |
1 |
RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef; |
|
336
|
9094 |
0 |
EXTRACT(self); |
|
|
0 |
9094 |
EXTRACT(self); |
|
|
0 |
9094 |
EXTRACT(self); |
|
343
|
5181 |
3913 |
if (items == 4) { val = (int64_t)SvIV(ST(3)); } |
|
344
|
3912 |
1 |
else if (items == 5) { z = (double)SvNV(ST(3)); val = (int64_t)SvIV(ST(4)); } |
|
345
|
1 |
0 |
else if (items == 6) { z = (double)SvNV(ST(3)); val = (int64_t)SvIV(ST(4)); radius = (double)SvNV(ST(5)); } |
|
347
|
9094 |
0 |
if (radius < 0 || !isfinite(radius)) croak("insert: radius must be a finite number >= 0"); |
|
|
0 |
9094 |
if (radius < 0 || !isfinite(radius)) croak("insert: radius must be a finite number >= 0"); |
|
352
|
9091 |
3 |
RETVAL = (idx == SPH_NONE) ? &PL_sv_undef : newSVuv(idx); |
|
363
|
657 |
0 |
EXTRACT(self); |
|
|
0 |
657 |
EXTRACT(self); |
|
|
0 |
657 |
EXTRACT(self); |
|
367
|
651 |
6 |
if (items == 5) z = (double)SvNV(ST(4)); |
|
368
|
0 |
6 |
else if (items != 4) croak("move: expected (handle,x,y) or (handle,x,y,z)"); |
|
381
|
463 |
0 |
EXTRACT(self); |
|
|
0 |
463 |
EXTRACT(self); |
|
|
0 |
463 |
EXTRACT(self); |
|
395
|
14 |
0 |
EXTRACT(self); |
|
|
0 |
14 |
EXTRACT(self); |
|
|
0 |
14 |
EXTRACT(self); |
|
408
|
11 |
0 |
EXTRACT(self); |
|
|
0 |
11 |
EXTRACT(self); |
|
|
0 |
11 |
EXTRACT(self); |
|
411
|
2 |
9 |
REQUIRE_LIVE_RD(h, (uint32_t)handle); |
|
423
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
426
|
2 |
1 |
REQUIRE_LIVE(h, (uint32_t)handle); |
|
437
|
454 |
0 |
EXTRACT(self); |
|
|
0 |
454 |
EXTRACT(self); |
|
|
0 |
454 |
EXTRACT(self); |
|
439
|
454 |
0 |
if (radius < 0 || !isfinite(radius)) croak("set_radius: radius must be a finite number >= 0"); |
|
|
0 |
454 |
if (radius < 0 || !isfinite(radius)) croak("set_radius: radius must be a finite number >= 0"); |
|
441
|
1 |
453 |
REQUIRE_LIVE(h, (uint32_t)handle); |
|
451
|
8 |
0 |
EXTRACT(self); |
|
|
0 |
8 |
EXTRACT(self); |
|
|
0 |
8 |
EXTRACT(self); |
|
454
|
2 |
6 |
REQUIRE_LIVE_RD(h, (uint32_t)handle); |
|
465
|
4 |
0 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
468
|
4 |
0 |
if (!SvROK(rows) || SvTYPE(SvRV(rows)) != SVt_PVAV) |
|
|
0 |
4 |
if (!SvROK(rows) || SvTYPE(SvRV(rows)) != SVt_PVAV) |
|
475
|
8 |
4 |
for (SSize_t i = 0; i < nr; i++) { |
|
477
|
8 |
0 |
if (!rv || !SvROK(*rv) || SvTYPE(SvRV(*rv)) != SVt_PVAV) continue; |
|
|
8 |
0 |
if (!rv || !SvROK(*rv) || SvTYPE(SvRV(*rv)) != SVt_PVAV) continue; |
|
|
0 |
8 |
if (!rv || !SvROK(*rv) || SvTYPE(SvRV(*rv)) != SVt_PVAV) continue; |
|
480
|
1 |
7 |
if (rl != 3 && rl != 4) continue; |
|
|
0 |
1 |
if (rl != 3 && rl != 4) continue; |
|
482
|
1 |
7 |
SV **zp = (rl == 4) ? av_fetch(row, 3, 0) : NULL; |
|
483
|
8 |
0 |
if (!hp || !xp || !yp) continue; |
|
|
8 |
0 |
if (!hp || !xp || !yp) continue; |
|
|
0 |
8 |
if (!hp || !xp || !yp) continue; |
|
484
|
1 |
7 |
if (sph_move_locked(h, (uint32_t)SvUV(*hp), SvNV(*xp), SvNV(*yp), zp ? SvNV(*zp) : 0.0)) moved++; |
|
|
7 |
1 |
if (sph_move_locked(h, (uint32_t)SvUV(*hp), SvNV(*xp), SvNV(*yp), zp ? SvNV(*zp) : 0.0)) moved++; |
|
486
|
3 |
1 |
if (nr > 0) __atomic_fetch_add(&h->hdr->stat_ops, (uint64_t)nr, __ATOMIC_RELAXED); |
|
489
|
0 |
4 |
RETVAL = moved; |
|
498
|
4 |
0 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
500
|
4 |
0 |
if (!SvROK(rows) || SvTYPE(SvRV(rows)) != SVt_PVAV) |
|
|
0 |
4 |
if (!SvROK(rows) || SvTYPE(SvRV(rows)) != SVt_PVAV) |
|
505
|
4 |
0 |
EXTEND(SP, nr); |
|
|
0 |
4 |
EXTEND(SP, nr); |
|
507
|
7 |
4 |
for (SSize_t i = 0; i < nr; i++) { |
|
510
|
7 |
0 |
if (rv && SvROK(*rv) && SvTYPE(SvRV(*rv)) == SVt_PVAV) { |
|
|
7 |
0 |
if (rv && SvROK(*rv) && SvTYPE(SvRV(*rv)) == SVt_PVAV) { |
|
|
7 |
0 |
if (rv && SvROK(*rv) && SvTYPE(SvRV(*rv)) == SVt_PVAV) { |
|
513
|
2 |
5 |
if (rl == 3 || rl == 4) { |
|
|
1 |
1 |
if (rl == 3 || rl == 4) { |
|
515
|
1 |
5 |
SV **rp = (rl == 4) ? av_fetch(row, 3, 0) : NULL; |
|
516
|
6 |
0 |
if (xp && yp && vp) { |
|
|
6 |
0 |
if (xp && yp && vp) { |
|
|
6 |
0 |
if (xp && yp && vp) { |
|
517
|
1 |
5 |
double rad = rp ? SvNV(*rp) : 0.0; |
|
520
|
6 |
0 |
if (rad >= 0 && isfinite(rad)) |
|
|
6 |
0 |
if (rad >= 0 && isfinite(rad)) |
|
526
|
5 |
2 |
PUSHs(idx == SPH_NONE ? &PL_sv_undef : sv_2mortal(newSVuv(idx))); |
|
528
|
3 |
1 |
if (nr > 0) __atomic_fetch_add(&h->hdr->stat_ops, (uint64_t)nr, __ATOMIC_RELAXED); |
|
537
|
13 |
0 |
EXTRACT(self); |
|
|
0 |
13 |
EXTRACT(self); |
|
|
0 |
13 |
EXTRACT(self); |
|
541
|
2 |
11 |
REQUIRE_LIVE_RD(h, (uint32_t)handle); |
|
546
|
0 |
11 |
EXTEND(SP, 3); |
|
557
|
17 |
0 |
EXTRACT(self); |
|
|
0 |
17 |
EXTRACT(self); |
|
|
0 |
17 |
EXTRACT(self); |
|
559
|
1 |
16 |
if (items != 3 && items != 4) croak("query_cell: (x,y) or (x,y,z)"); |
|
|
0 |
1 |
if (items != 3 && items != 4) croak("query_cell: (x,y) or (x,y,z)"); |
|
560
|
1 |
16 |
int dims = (items == 4) ? 3 : 2; |
|
561
|
1 |
16 |
double p[3] = { x, y, dims==3 ? (double)SvNV(ST(3)) : 0 }; |
|
562
|
0 |
17 |
EMIT_QUERY(sph_query_cell(h, p, dims, &col)); |
|
|
0 |
17 |
EMIT_QUERY(sph_query_cell(h, p, dims, &col)); |
|
|
17 |
0 |
EMIT_QUERY(sph_query_cell(h, p, dims, &col)); |
|
|
0 |
17 |
EMIT_QUERY(sph_query_cell(h, p, dims, &col)); |
|
|
24 |
17 |
EMIT_QUERY(sph_query_cell(h, p, dims, &col)); |
|
568
|
12 |
0 |
EXTRACT(self); |
|
|
0 |
12 |
EXTRACT(self); |
|
|
0 |
12 |
EXTRACT(self); |
|
571
|
9 |
3 |
if (items == 5) { dims = 2; |
|
573
|
3 |
0 |
} else if (items == 7) { dims = 3; |
|
577
|
0 |
12 |
EMIT_QUERY(sph_query_aabb(h, lo, hi, dims, &col)); |
|
|
1 |
11 |
EMIT_QUERY(sph_query_aabb(h, lo, hi, dims, &col)); |
|
|
11 |
0 |
EMIT_QUERY(sph_query_aabb(h, lo, hi, dims, &col)); |
|
|
0 |
11 |
EMIT_QUERY(sph_query_aabb(h, lo, hi, dims, &col)); |
|
|
133 |
11 |
EMIT_QUERY(sph_query_aabb(h, lo, hi, dims, &col)); |
|
583
|
192 |
0 |
EXTRACT(self); |
|
|
0 |
192 |
EXTRACT(self); |
|
|
0 |
192 |
EXTRACT(self); |
|
586
|
106 |
86 |
if (items == 4) { dims = 2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); r=SvNV(ST(3)); } |
|
587
|
86 |
0 |
else if (items == 5) { dims = 3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); r=SvNV(ST(4)); } |
|
589
|
192 |
0 |
if (r < 0 || !isfinite(r)) croak("query_radius: r must be a finite number >= 0"); |
|
|
0 |
192 |
if (r < 0 || !isfinite(r)) croak("query_radius: r must be a finite number >= 0"); |
|
590
|
0 |
192 |
EMIT_QUERY(sph_query_radius(h, c, r, dims, &col)); |
|
|
1 |
191 |
EMIT_QUERY(sph_query_radius(h, c, r, dims, &col)); |
|
|
191 |
0 |
EMIT_QUERY(sph_query_radius(h, c, r, dims, &col)); |
|
|
0 |
191 |
EMIT_QUERY(sph_query_radius(h, c, r, dims, &col)); |
|
|
2155 |
191 |
EMIT_QUERY(sph_query_radius(h, c, r, dims, &col)); |
|
602
|
7 |
0 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
604
|
7 |
0 |
if (!SvROK(queries) || SvTYPE(SvRV(queries)) != SVt_PVAV) |
|
|
0 |
7 |
if (!SvROK(queries) || SvTYPE(SvRV(queries)) != SVt_PVAV) |
|
610
|
6 |
1 |
if (nq > 0) av_extend(out, nq - 1); |
|
613
|
103 |
7 |
for (SSize_t i = 0; i < nq && !err; i++) { |
|
|
103 |
0 |
for (SSize_t i = 0; i < nq && !err; i++) { |
|
616
|
103 |
0 |
if (qp && SvROK(*qp) && SvTYPE(SvRV(*qp)) == SVt_PVAV) { |
|
|
102 |
1 |
if (qp && SvROK(*qp) && SvTYPE(SvRV(*qp)) == SVt_PVAV) { |
|
|
102 |
0 |
if (qp && SvROK(*qp) && SvTYPE(SvRV(*qp)) == SVt_PVAV) { |
|
620
|
71 |
31 |
if (ql == 3) { |
|
622
|
71 |
0 |
if (x && y && rr) { dims=2; c[0]=SvNV(*x); c[1]=SvNV(*y); r=SvNV(*rr); } |
|
|
71 |
0 |
if (x && y && rr) { dims=2; c[0]=SvNV(*x); c[1]=SvNV(*y); r=SvNV(*rr); } |
|
|
71 |
0 |
if (x && y && rr) { dims=2; c[0]=SvNV(*x); c[1]=SvNV(*y); r=SvNV(*rr); } |
|
623
|
30 |
1 |
} else if (ql == 4) { |
|
625
|
30 |
0 |
if (x && y && z && rr) { dims=3; c[0]=SvNV(*x); c[1]=SvNV(*y); c[2]=SvNV(*z); r=SvNV(*rr); } |
|
|
30 |
0 |
if (x && y && z && rr) { dims=3; c[0]=SvNV(*x); c[1]=SvNV(*y); c[2]=SvNV(*z); r=SvNV(*rr); } |
|
|
30 |
0 |
if (x && y && z && rr) { dims=3; c[0]=SvNV(*x); c[1]=SvNV(*y); c[2]=SvNV(*z); r=SvNV(*rr); } |
|
|
30 |
0 |
if (x && y && z && rr) { dims=3; c[0]=SvNV(*x); c[1]=SvNV(*y); c[2]=SvNV(*z); r=SvNV(*rr); } |
|
627
|
101 |
1 |
if (dims && r >= 0 && isfinite(r)) { |
|
|
100 |
1 |
if (dims && r >= 0 && isfinite(r)) { |
|
|
99 |
1 |
if (dims && r >= 0 && isfinite(r)) { |
|
630
|
0 |
99 |
if (rc == SPH_Q_OOM) { free(col.vals); err = 1; } |
|
631
|
1 |
98 |
else if (rc == SPH_Q_TOOBIG) { free(col.vals); err = 2; } |
|
633
|
77 |
21 |
if (col.n) av_extend(res, (SSize_t)col.n - 1); |
|
634
|
1548 |
98 |
for (size_t k = 0; k < col.n; k++) av_push(res, newSViv((IV)col.vals[k])); |
|
643
|
1 |
6 |
if (err) { |
|
645
|
0 |
1 |
if (err == 1) croak("query_radius_many: out of memory"); |
|
661
|
807 |
0 |
EXTRACT(self); |
|
|
0 |
807 |
EXTRACT(self); |
|
|
0 |
807 |
EXTRACT(self); |
|
665
|
1 |
806 |
if (!(h->hdr->sphere_radius > 0.0)) croak("insert_geo: map was not created with sphere => R"); |
|
671
|
806 |
0 |
RETVAL = (idx == SPH_NONE) ? &PL_sv_undef : newSVuv(idx); |
|
683
|
3 |
0 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
|
0 |
3 |
EXTRACT(self); |
|
686
|
1 |
2 |
if (!(h->hdr->sphere_radius > 0.0)) croak("move_geo: map was not created with sphere => R"); |
|
700
|
307 |
0 |
EXTRACT(self); |
|
|
0 |
307 |
EXTRACT(self); |
|
|
0 |
307 |
EXTRACT(self); |
|
703
|
1 |
306 |
if (!(h->hdr->sphere_radius > 0.0)) croak("position_geo: map was not created with sphere => R"); |
|
705
|
1 |
305 |
REQUIRE_LIVE_RD(h, (uint32_t)handle); |
|
711
|
0 |
305 |
EXTEND(SP, 3); |
|
724
|
27 |
0 |
EXTRACT(self); |
|
|
0 |
27 |
EXTRACT(self); |
|
|
0 |
27 |
EXTRACT(self); |
|
727
|
1 |
26 |
if (!(h->hdr->sphere_radius > 0.0)) croak("query_geo_radius: map was not created with sphere => R"); |
|
728
|
25 |
1 |
if (dist < 0 || !isfinite(dist)) croak("query_geo_radius: dist must be a finite number >= 0"); |
|
|
0 |
25 |
if (dist < 0 || !isfinite(dist)) croak("query_geo_radius: dist must be a finite number >= 0"); |
|
730
|
0 |
25 |
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col)); |
|
|
0 |
25 |
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col)); |
|
|
25 |
0 |
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col)); |
|
|
0 |
25 |
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col)); |
|
|
293 |
25 |
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col)); |
|
740
|
41308 |
0 |
EXTRACT(self); |
|
|
0 |
41308 |
EXTRACT(self); |
|
|
0 |
41308 |
EXTRACT(self); |
|
744
|
41307 |
1 |
if (level < 0 || level > SPH_CUBE_MAX_LEVEL) croak("cube_cell: level must be in 0..%d", SPH_CUBE_MAX_LEVEL); |
|
|
1 |
41306 |
if (level < 0 || level > SPH_CUBE_MAX_LEVEL) croak("cube_cell: level must be in 0..%d", SPH_CUBE_MAX_LEVEL); |
|
757
|
303 |
0 |
EXTRACT(self); |
|
|
0 |
303 |
EXTRACT(self); |
|
|
0 |
303 |
EXTRACT(self); |
|
761
|
302 |
1 |
if (level < 0 || level > SPH_CUBE_MAX_LEVEL) croak("cube_cell_geo: level must be in 0..%d", SPH_CUBE_MAX_LEVEL); |
|
|
1 |
301 |
if (level < 0 || level > SPH_CUBE_MAX_LEVEL) croak("cube_cell_geo: level must be in 0..%d", SPH_CUBE_MAX_LEVEL); |
|
772
|
20002 |
0 |
EXTRACT(self); |
|
|
0 |
20002 |
EXTRACT(self); |
|
|
0 |
20002 |
EXTRACT(self); |
|
775
|
1 |
20001 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_level: not a valid cube cell id"); |
|
776
|
19998 |
3 |
RETVAL = (IV)sph_cube_level((uint64_t)cell); |
|
785
|
39003 |
0 |
EXTRACT(self); |
|
|
0 |
39003 |
EXTRACT(self); |
|
|
0 |
39003 |
EXTRACT(self); |
|
789
|
1 |
39002 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_center: not a valid cube cell id"); |
|
791
|
0 |
39002 |
EXTEND(SP, 3); |
|
801
|
2 |
0 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
|
0 |
2 |
EXTRACT(self); |
|
805
|
1 |
1 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_center_geo: not a valid cube cell id"); |
|
808
|
0 |
1 |
EXTEND(SP, 2); |
|
817
|
8002 |
0 |
EXTRACT(self); |
|
|
0 |
8002 |
EXTRACT(self); |
|
|
0 |
8002 |
EXTRACT(self); |
|
821
|
1 |
8001 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_parent: not a valid cube cell id"); |
|
822
|
8000 |
1 |
RETVAL = sph_cube_parent((uint64_t)cell, &p) ? newSVuv((UV)p) : &PL_sv_undef; |
|
831
|
2002 |
0 |
EXTRACT(self); |
|
|
0 |
2002 |
EXTRACT(self); |
|
|
0 |
2002 |
EXTRACT(self); |
|
835
|
1 |
2001 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_children: not a valid cube cell id"); |
|
836
|
2000 |
1 |
if (sph_cube_children((uint64_t)cell, kids)) { |
|
837
|
0 |
2000 |
EXTEND(SP, 4); |
|
838
|
8000 |
2000 |
for (int k = 0; k < 4; k++) PUSHs(sv_2mortal(newSVuv((UV)kids[k]))); |
|
846
|
30121 |
0 |
EXTRACT(self); |
|
|
0 |
30121 |
EXTRACT(self); |
|
|
0 |
30121 |
EXTRACT(self); |
|
850
|
1 |
30120 |
if (!sph_cube_valid((uint64_t)cell)) croak("cube_neighbors: not a valid cube cell id"); |
|
852
|
0 |
30120 |
EXTEND(SP, 4); |
|
853
|
120480 |
30120 |
for (int k = 0; k < 4; k++) PUSHs(sv_2mortal(newSVuv((UV)nb[k]))); |
|
858
|
57 |
0 |
EXTRACT(self); |
|
|
0 |
57 |
EXTRACT(self); |
|
|
0 |
57 |
EXTRACT(self); |
|
861
|
32 |
25 |
if (items == 4) { dims = 2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); k=(uint32_t)SvUV(ST(3)); } |
|
862
|
25 |
0 |
else if (items == 5) { dims = 3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); k=(uint32_t)SvUV(ST(4)); } |
|
864
|
1 |
56 |
if (k == 0) croak("query_knn: k must be >= 1"); |
|
865
|
0 |
56 |
EMIT_QUERY(sph_query_knn(h, c, k, dims, &col)); |
|
|
0 |
56 |
EMIT_QUERY(sph_query_knn(h, c, k, dims, &col)); |
|
|
56 |
0 |
EMIT_QUERY(sph_query_knn(h, c, k, dims, &col)); |
|
|
0 |
56 |
EMIT_QUERY(sph_query_knn(h, c, k, dims, &col)); |
|
|
293 |
56 |
EMIT_QUERY(sph_query_knn(h, c, k, dims, &col)); |
|
870
|
7 |
0 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
874
|
6 |
1 |
if (items == 5) { dims=2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); r=SvNV(ST(3)); cb=ST(4); } |
|
875
|
1 |
0 |
else if (items == 6) { dims=3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); r=SvNV(ST(4)); cb=ST(5); } |
|
877
|
7 |
0 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_in_radius: last arg must be a coderef"); |
|
|
0 |
7 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_in_radius: last arg must be a coderef"); |
|
878
|
7 |
0 |
if (r < 0 || !isfinite(r)) croak("each_in_radius: r must be a finite number >= 0"); |
|
|
0 |
7 |
if (r < 0 || !isfinite(r)) croak("each_in_radius: r must be a finite number >= 0"); |
|
884
|
0 |
7 |
if (rc == SPH_Q_OOM) { free(col.vals); croak("each_in_radius: out of memory"); } |
|
885
|
0 |
7 |
if (rc == SPH_Q_TOOBIG) { free(col.vals); croak(SPH_TOOBIG_MSG, (unsigned)SPH_MAX_QUERY_CELLS); } |
|
888
|
32 |
6 |
for (size_t i = 0; i < col.n; i++) { |
|
889
|
0 |
32 |
dSP; ENTER; SAVETMPS; PUSHMARK(SP); |
|
890
|
0 |
32 |
XPUSHs(sv_2mortal(newSViv((IV)col.vals[i]))); |
|
893
|
32 |
0 |
FREETMPS; LEAVE; |
|
894
|
32 |
0 |
if (SvTRUE(ERRSV)) { free(col.vals); croak_sv(ERRSV); } |
|
|
1 |
31 |
if (SvTRUE(ERRSV)) { free(col.vals); croak_sv(ERRSV); } |
|
|
1 |
0 |
if (SvTRUE(ERRSV)) { free(col.vals); croak_sv(ERRSV); } |
|
904
|
6 |
0 |
EXTRACT(self); |
|
|
0 |
6 |
EXTRACT(self); |
|
|
0 |
6 |
EXTRACT(self); |
|
906
|
6 |
0 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_pair_within: last arg must be a coderef"); |
|
|
0 |
6 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_pair_within: last arg must be a coderef"); |
|
907
|
6 |
0 |
if (max_r < 0 || !isfinite(max_r)) croak("each_pair_within: max_r must be a finite number >= 0"); |
|
|
0 |
6 |
if (max_r < 0 || !isfinite(max_r)) croak("each_pair_within: max_r must be a finite number >= 0"); |
|
908
|
0 |
6 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
0 |
6 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
0 |
1315 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
0 |
1315 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
0 |
1315 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
1315 |
0 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
1315 |
0 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
1 |
1314 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
1 |
0 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
|
1315 |
5 |
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col)); |
|
915
|
4 |
0 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
|
0 |
4 |
EXTRACT(self); |
|
917
|
4 |
0 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_colliding_pair: arg must be a coderef"); |
|
|
0 |
4 |
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_colliding_pair: arg must be a coderef"); |
|
918
|
0 |
4 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
4 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
3333 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
3333 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
3333 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
3333 |
0 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
3333 |
0 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
3333 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
0 |
0 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
|
3333 |
4 |
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col)); |
|
923
|
1 |
0 |
EXTRACT(self); |
|
|
0 |
1 |
EXTRACT(self); |
|
|
0 |
1 |
EXTRACT(self); |
|
933
|
7 |
0 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
|
0 |
7 |
EXTRACT(self); |
|
948
|
7 |
0 |
hv_store(hv, "load_factor", 11, newSVnv(nb ? (double)cnt / nb : 0), 0); |