fix nitpicks

This commit is contained in:
Alain Zscheile 2023-01-04 09:47:58 +01:00
parent a13f2271da
commit 21c7228038
5 changed files with 13 additions and 13 deletions

View file

@ -48,8 +48,8 @@ static uint32_t y16t_db_palloc2(void * context_)
__attribute__((nonnull)) __attribute__((nonnull))
static int y16t_db_intern_pgsearch( static int y16t_db_intern_pgsearch(
const int fd, const int fd,
off_t start_offset, const off_t start_offset,
uint8_t bufexp[], const uint8_t bufexp[],
uint32_t *i_ uint32_t *i_
) { ) {
uint8_t buf[4096] = {0}; uint8_t buf[4096] = {0};

View file

@ -1,5 +1,8 @@
// SPDX-License-Identifier: ISC // SPDX-License-Identifier: ISC
#include "y16t_internal.h" // this file is directly included by idx.c
// conversion between hilbert curve distance and x,y values
#include <inttypes.h>
// rotate/flip a quadrant appropriately // rotate/flip a quadrant appropriately
static void y16t_hilbert_rot( static void y16t_hilbert_rot(
@ -23,7 +26,7 @@ static void y16t_hilbert_rot(
} }
__attribute__((pure)) __attribute__((pure))
uint32_t y16t_hilbert_xy2d(uint32_t n, uint32_t x, uint32_t y) { static uint32_t y16t_hilbert_xy2d(uint32_t n, uint32_t x, uint32_t y) {
uint32_t rx, ry, s, d=0; uint32_t rx, ry, s, d=0;
for (s=n/2; s>0; s/=2) { for (s=n/2; s>0; s/=2) {
rx = (x & s) > 0; rx = (x & s) > 0;
@ -34,7 +37,8 @@ uint32_t y16t_hilbert_xy2d(uint32_t n, uint32_t x, uint32_t y) {
return d; return d;
} }
void y16t_hilbert_d2xy(uint32_t n, uint32_t d, uint32_t *x, uint32_t *y) { /*
static void y16t_hilbert_d2xy(uint32_t n, uint32_t d, uint32_t *x, uint32_t *y) {
uint32_t rx, ry, s, t=d; uint32_t rx, ry, s, t=d;
*x = *y = 0; *x = *y = 0;
for (s=1; s<n; s*=2) { for (s=1; s<n; s*=2) {
@ -46,3 +50,4 @@ void y16t_hilbert_d2xy(uint32_t n, uint32_t d, uint32_t *x, uint32_t *y) {
t /= 4; t /= 4;
} }
} }
*/

View file

@ -5,6 +5,8 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include "hilbert.c"
static __attribute__((pure)) static __attribute__((pure))
uint32_t y16t_table_at(const y16t_idx_t idx, const uint8_t x, const uint8_t y) uint32_t y16t_table_at(const y16t_idx_t idx, const uint8_t x, const uint8_t y)
{ {

View file

@ -1,7 +1,7 @@
install_headers('y16t_db.h', 'y16t_idx.h') install_headers('y16t_db.h', 'y16t_idx.h')
liby16t = shared_library('y16t', liby16t = shared_library('y16t',
files('db.c', 'hilbert.c', 'idx.c', 'pall.c'), files('db.c', 'idx.c', 'pall.c'),
version : '0.0.0', version : '0.0.0',
c_args : [c_base_args], c_args : [c_base_args],
include_directories : include_directories('.'), include_directories : include_directories('.'),

View file

@ -3,13 +3,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <inttypes.h> #include <inttypes.h>
// conversion between hilbert curve distance and x,y values
__attribute__((pure))
uint32_t y16t_hilbert_xy2d(uint32_t n, uint32_t x, uint32_t y);
void y16t_hilbert_d2xy(uint32_t n, uint32_t d, uint32_t *x, uint32_t *y);
// handling of resumption of pread/pwrite calls // handling of resumption of pread/pwrite calls
ssize_t y16t_pread_all(int fd, void *buf, size_t nbyte, off_t offset); ssize_t y16t_pread_all(int fd, void *buf, size_t nbyte, off_t offset);