text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
#include "libm.h" float __math_oflowf(uint32_t sign) { return __math_xflowf(sign, 0x1p97f); } <|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>eturn __math_xflow(sign, 0x1p-767); } <|fim_prefix|>#include "libm.h"<|fim_middle|> double __math_uflow(uint32_t sign) { r<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>wf(sign, 0x1p-95f); } <|fim_prefix|>#include "libm.h" float __math_uflowf(uint32_<|fim_middle|>t sign) { return __math_xflo<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>e(fp_barrier(sign ? -y : y) * y); } <|fim_prefix|>#include "libm.h" <|fim_middle|>double __math_xflow(uint32_t sign, double y) { return eval_as_doubl<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>loat y) { return eval_as_float(fp_barrierf(sign ? -y : y) * y); } <|fim_prefix|>#in<|fim_middle|>clude "libm.h" float __math_xflowf(uint32_t sign, f<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* origin: OpenBSD /usr/src/lib/libm/src/polevll.c */ /* * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permissio...
fim
ClickHouse/ClickHouse
c
#define a_ll a_ll static inline int a_ll(volatile int *p) { int v; __asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p)); return v; } #define a_sc a_sc static inline int a_sc(volatile int *p, int v) { int r; __asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory"); return !r; } #de...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#define VDSO_USEFUL #define VDS<|fim_suffix|>ttime" #define VDSO_CGT_VER "LINUX_2.6.39" <|fim_middle|>O_CGT_SYM "__kernel_clock_ge<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>return ret; } <|fim_prefix|>#define _GNU_SOURCE #include <sys/socket.h> #include <errno.h> #include <fcntl.h> #include "syscall.h" int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int flg) { if (!flg) return accept(fd, addr, len); int ret = socketcall_cp(accept4, fd, addr, l...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#ifndef _ATOMIC_H #define _ATOMIC_H #include <stdint.h> #include "atomic_arch.h" #ifdef a_ll #ifndef a_pre_llsc #define a_pre_llsc() #endif #ifndef a_post_llsc #define a_post_llsc() #endif #ifndef a_cas #define a_cas a_cas static inline int <|fim_suffix|>er a_barrier static void a_barrier() { volat...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> } return __syscall_ret(r); } #endif /* If reaching this point, it's a 64-bit arch or time64-only * 32-bit arch and we can get result directly into timespec. */ return syscall(SYS_clock_getres, clk, ts); } <|fim_prefix|>#include <time.h> #include <unistd.h> #include "syscall.h" int clock_getres(cl...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <errno.h> #include <stdint.h> #include <time.h> #include "atomic.h" #include "syscall.h" #ifdef VDSO_CGT_SYM static void *volatile vdso_func; #ifdef VDSO_CGT32_SYM static void *volatile vdso_func_32; static int cgt_time32_wrap(clockid_t clk, struct timespec *ts) { long ts32[2]; int (*f)(cloc...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <errno.h> #include <pthread.h> #include <time.h> #include "syscall.h" int clock_nanosleep(clockid_t clk, int flags, const struct timespec * req, struct timespec * rem) { if (clk == CLOCK_THREAD_CPUTIME_ID) return EINVAL; int old_cancel_type; int status; /// We cannot port...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>t(r); } while ((r=__syscall(SYS_dup2, old, new))==-EBUSY); if (flags & O_CLOEXEC) __syscall(SYS_fcntl, new, F_SETFD, FD_CLOEXEC); #else while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY); #endif return __syscall_ret(r); } <|fim_prefix|>#define _GNU_SOURCE #include <unistd.h> #include <errno.h> ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to); #endif return __syscall_ret(r); } int epoll_wait(int fd, struct epoll_event *ev, int cnt, int to) { return epoll_pwait(fd, ev, cnt, to, 0); } <|fim_prefix|>#include <sys/epoll.h> #include <signal.h> #include <errno.h> #include "syscall.h" int epo...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <sys/eventfd.h> #include <unistd.h> #include <errno.h> #include "syscall.h" int eventfd(unsigned int count, int flags) { int r = __syscall(SYS_eventfd2, count, flags); #ifdef SYS_eventfd if (r==-ENOSYS && !flags) r = __syscall(SYS_eventfd, count); #endif <|fim_suffix|>t(r); } int eventfd_rea...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> return __math_oflow(0); } /* Large x is special cased below. */ abstop = 0; } /* exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]. */ /* x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]. */ z = InvLn2N * x; #if TOINT_INTRINSICS kd = roundtoint(z); ki = converttoint(z...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>; /* This is only a valid scale when -1023*N < k < 1024*N. */ sbits = T[idx + 1] + top; /* exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1). */ /* Evaluation is optimized assuming superscalar pipelined execution. */ r2 = r * r; /* Without fma the worst case error is 0.5/N ulp larger. ...
fim
ClickHouse/ClickHouse
c
/* * Single-precision 2^x function. * * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "exp2f_data.h" /* EXP2F_TABLE_BITS = 5 EXP2F_POLY_ORDER = 3 ULP error: 0.502 (nearest rounding.) Relative error: 1.69 * 2^-34 in [-1/64...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Shared data between expf, exp2f and powf. * * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include "exp2f_data.h" #define N (1 << EXP2F_TABLE_BITS) const struct exp2f_data __exp2f_data = { /* tab[i] = uint(2^(i/N)) - (i << 52-BITS) used for computing 2^(k/N)...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>ORDER]; } __exp2f_data; #endif <|fim_prefix|>/* * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _EXP2F_DATA_H #define _EXP2F_DATA_H #include "musl_features.h" #include <stdint.h> /* Shared between expf, exp2f and powf. */ #define EXP2F_TABLE_BITS 5 #de<|fim_middle|...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Shared data between exp, exp2 and pow. * * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include "exp_data.h" #define N (1 << EXP_TABLE_BITS) const struct exp_data __exp_data = { // N/ln2 .invln2N = 0x1.71547652b82fep0 * N, // -ln2/N .negln2hiN = -0x1.62e42fefa0000p-8, ....
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* <|fim_suffix|>ft; double exp2_poly[EXP2_POLY_ORDER]; uint64_t tab[2*(1 << EXP_TABLE_BITS)]; } __exp_data; #endif <|fim_middle|>* Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _EXP_DATA_H #define _EXP_DATA_H #include "musl_features.h" #include <stdint.h> #define EXP_...
fim
ClickHouse/ClickHouse
c
/* origin: FreeBSD /usr/src/lib/msun/src/e_expf.c */ /* * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. busi...
fim
ClickHouse/ClickHouse
c
#define _GNU_SOURCE #include <fcntl.h> #include <sys/syscall.h> extern long int syscall (long int __sysno, ...) __THROW; int fallocate(int fd, int mode, off_t base, off_t len) { return syscall(SYS_fallocate, fd, mode, base, len); } int fallocate64(int fd, int mode, off_t base, off_t len) { return fallocate(fd, mod...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>XEC, 0); if (ret != -EINVAL) { if (ret >= 0) __syscall(SYS_close, ret); return __syscall_ret(-EINVAL); } ret = __syscall(SYS_fcntl, fd, F_DUPFD, arg); if (ret >= 0) __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC); return __syscall_ret(ret); ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>tmp[i].tv_usec = times[i].tv_nsec / 1000; } } r = __syscall(SYS_futimesat, fd, 0, tv); if (r != -ENOSYS || fd != AT_FDCWD) return __syscall_ret(r); r = __syscall(SYS_utimes, 0, tv); #endif return __syscall_ret(r); } <|fim_prefix|>#include <sys/stat.h> #include <sys/time.h> #include <fcntl.<|fim_mi...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include "atomic.h" #include <sys/auxv.h> #include <fcntl.h> // open #include <sys/stat.h> // O_RDONLY #include <unistd.h> // read, close #include <stdlib.h> // ssize_t #include <stdio.h> // perror, fprintf #include <link.h> // ElfW #include <errno.h> #include "syscall.h" #if defined(__has_feature) #if ...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#define _DEFAULT_SOURCE #include <unistd.h> #include <sys/random.h> #include <pthread.h> #include <errno.h> int getentropy(void *buffer, size_t len) { int cs, ret = 0; char *pos = buffer; if (len > 256) { errno = EIO; return -1; } pthread_setcancelstate(<|fim_suffix|>(errno == EINTR) continue;...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/** We have to replace glibc getrandom only when glibc version is higher than 2.25. * In previous versions of glibc this function doesn't exist * and old kernels may be missing SYS_getrandom syscall. */ #include <features.h> #if defined(__GLIBC__) && __GLIBC__ >= 2 # define GLI<|fim_suffix|>OR __GNU_...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>t = match->next; free(match); } } static int sort(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, int err), glob_t *restrict g) { const char *p=pat, *d; struct match head = { .next...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>n __syscall_ret(r); } int inotify_add_watch(int fd, const char *pathname, uint32_t mask) { return syscall(SYS_inotify_add_watch, fd, pathname, mask); } int inotify_rm_watch(int fd, int wd) { return syscall(SYS_inotify_rm_watch, fd, wd); } <|fim_prefix|>#include <sys/inotify.h> #include <errno.h> #incl...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ r2 = 7.21935547567138069525e-01, /* 0x3FE71A18,...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>r += 0.5 * y + y * p1/p2; break; case 1: p1 = g0 + y * (g1 + y * (g2 + y * (g3 + y * (g4 + y * (g5 + y * g6))))); p2 = h0 + y * (h1 + y * (h2 + y * (h3 + y * (h4 + y * (h5 + y))))); p = tt + y * p1/p2; r += (tf + p); break; case 2: p1 = y * (u0 + y * (u1 + y * (u2 + y * (u3 + y * ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> \ (hi) = asuint64(d) >> 32; \ } while (0) #define GET_LOW_WORD(lo,d) \ do { \ (lo) = (uint32_t)asuint64(d); \ } while (0) #define INSERT_WORDS(d,hi,lo) \...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Double-precision log(x) function. * * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "log_data.h" #define T __log_data.tab #define T2 __log_data.tab2 #define B __log_data.poly1 #define A __log_data.poly #defin...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Double-precision log2(x) function. * * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "log2_data.h" #define T __log2_data.tab #define T2 __log2_data.tab2 #define B __log2_data.poly1 #define A __log2_data.poly ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> -0x1.9217f5af86000p-2}, {0x1.4cab88e487bd0p+0, -0x1.8304db0719000p-2}, {0x1.49539b4334feep+0, -0x1.74189f9a9e000p-2}, {0x1.460cbdfafd569p+0, -0x1.6552bb5199000p-2}, {0x1.42d664ee4b953p+0, -0x1.56b23a29b1000p-2}, {0x1.3fb01111dd8a6p+0, -0x1.483650f5fa000p-2}, {0x1.3c995b70c5836p+0, -0x1.39de937f6a000p-2},...
fim
ClickHouse/ClickHouse
c
/* * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _LOG2_DATA_H #define _LOG2_DATA_H #include "musl_features.h" #define LOG2_TABLE_BITS 6 #define LOG2_POLY_ORDER 7 #define LOG2_POLY1_ORDER 11 extern hidden const struct log2_data { double invln2hi; double invln2lo; double poly[LOG2_P...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>normal, normalize it. */ ix = asuint(x * 0x1p23f); ix -= 23 << 23; } /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. The range is split into N subintervals. The ith subinterval contains z and c is near its center. */ tmp = ix - OFF; i = (tmp >> (23 - LOG2F_TABLE_BITS)) % N; to...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Data definition for log2f.<|fim_suffix|>08ae5bap+0, -0x1.960cbbf788d5cp-4 }, { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 }, { 0x1p+0, 0x0p+0 }, { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 }, { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 }, { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 }, ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>ER]; } __log2f_data; #endif <|fim_prefix|>/* * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _LOG2F_DATA_H #define _LOG2F_DATA_H #include "musl_features.h" #define LOG2F_TABLE_BITS 4 #def<|fim_middle|>ine LOG2F_POLY_ORDER 4 extern hidden const struct log2f_data { s...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Data for log. * * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include "log_data.h" #define N (1 << LOG_TABLE_BITS) const struct log_data __log_data = { .ln2hi = 0x1.62e42fefa3800p-1, .ln2lo = 0x1.ef35793c76730p-45, .poly1 = { // relative error: 0x1.c04d76cp-63 // in -0...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>_TABLE_BITS]; #endif } __log_data; #endif <|fim_prefix|>/* * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _LOG_DATA_H #define _LOG_DATA_H #include "musl_features.h" #define LOG_TABLE_BITS 7 #define LOG_POLY_ORDER 6 #define LOG_POLY1_ORDER 12 extern hidden const struct l...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Single-precision log function. * * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "logf_data.h" /* LOGF_TABLE_BITS = 4 LOGF_POLY_ORDER = 4 ULP error: 0.818 (nearest rounding.) Relative error: 1.957 * 2^-...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Data definition for logf. * * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include "logf_data.h" const struct logf_data _<|fim_suffix|>, 0x1.4043057b6ee09p-2 }, }, .ln2 = 0x1.62e42fefa39efp-1, .poly = { -0x1.00ea348b88334p-2, 0x1.5575b0be00b6ap-2, -0x1.ffffe...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _LOGF_DATA_H #define _LOGF_DATA_H #include "musl_features.h" #define LOGF_TABLE_BITS 4 #define LOGF_POLY_ORDER 4 extern hidden <|fim_suffix|><|fim_middle|>const struct logf_data { struct { double invc, logc; } ta...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <errno.h> #include <fcntl.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> /* This assumes that a check for the template<|fim_suffix|>template, int len) { size_t l = strlen(template); if (l < 6 || len > l - 6 || memcmp(template + l -...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>ne hidden __attribute__((__visibility__("hidden"))) #define predict_false(x) __builtin_expect(x, 0) <|fim_prefix|>#pragma once #define weak __attribu<|fim_middle|>te__((__weak__)) #defi<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#incl<|fim_suffix|>OCK); __syscall(SYS_fcntl, fd[1], F_SETFL, O_NONBLOCK); } return 0; } <|fim_middle|>ude <unistd.h> #include <errno.h> #include <fcntl.h> #include <syscall.h> #include "syscall.h" int pipe2(int fd[2], int flag) { if (!flag) return pipe(fd); int ret = __syscall(SYS_pipe2, fd, flag)...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/// Partial implementation derived from musl. The file_actions walking branch /// from musl is intentionally NOT restored: callers are compiled against /// glibc's <spawn.h>, whose posix_spawn_file_actions_t::__actions is an array /// of `struct __spawn_action` (tagged union), not musl's doubly-linked lis...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> lhi + y * llo; /* |elo| < |ehi| * 2^-25. */ #endif return exp_inline(ehi, elo, sign_bias); } <|fim_prefix|>/* * Double-precision x^y function. * * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "exp_data.h" #incl...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>0x1.16b5ccbacf800p-2, 0x1.b9acdf7a51681p-45) A(0x1.8400000000000p-1, 0x1.1bf99635a6800p-2, 0x1.ca6ed5147bdb7p-45) A(0x1.8200000000000p-1, 0x1.214456d0eb800p-2, 0x1.a87deba46baeap-47) A(0x1.7e00000000000p-1, 0x1.2bef07cdc9000p-2, 0x1.a9cfa4a5004f4p-45) A(0x1.7c00000000000p-1, 0x1.314f1e1d36000p-2, -0x1.8e2...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Copyright (c) 2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _POW_DATA_H #define _POW_DATA_H #include "musl_features.h" #define POW_LOG_TABLE_BITS 7 #define POW_LOG_POLY_ORDER 8 extern hidden const struct pow_log_data { double ln2hi; double ln2lo; double poly[POW_LOG_POLY_ORDER ...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #include <math.h> #include <stdint.h> #include "libm.h" #include "exp2f_data.h" #include "powf_data.h" /* POWF_LOG2_POLY_ORDER = 5 EXP2F_TABLE_BITS = 5 ULP error: 0.82 (~ 0.5 + relerr*2^24) relerr: 1.27 * 2^-26 (Relative er...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>/ #include "powf_data.h" const struct powf_log2_data __powf_log2_data = { .tab = { { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 * POWF_SCALE }, { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 * POWF_SCALE }, { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 * POWF_SCALE }, { 0x1.3c995b0b80385p+0, -0...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/* * Copyright (c) 2017-2018, Arm Limited. * SPDX-License-Identifier: MIT */ #ifndef _POWF_DATA_H #define _POWF_DATA_H #include "libm.h" #include "exp2f_data.h" #define POWF_LOG2_TABLE_BITS 4 #define POWF_LOG2_POLY_ORD<|fim_suffix|>f_log2_data; #endif <|fim_middle|>ER 5 #if TOINT_INTRINSICS #define ...
fim
ClickHouse/ClickHouse
c
/* origin: OpenBSD /usr/src/lib/libm/src/ld80/e_powl.c */ /* * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice a...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>nt, ofs); } <|fim_prefix|>#define _DEFAULT_SOURCE #include <sys/uio.h> #include <unistd.h> #include <sysca<|fim_middle|>ll.h> #include "syscall.h" ssize_t pwritev(int fd, const struct iovec *iov, int count, off_t ofs) { /// There was cancellable syscall (syscall_cp), but I don't care. return syscall...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> 126; if (n < -126) { y *= 0x1p-126f; n += 126; if (n < -126) n = -126; } } u.i = (uint32_t)(0x7f+n)<<23; x = y * u.f; return x; } <|fim_prefix|>#include <math.h> #include <stdint.h> float scalbnf(float x, int n) { un...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> cnt; } <|fim_prefix|>#define _GNU_SOURCE #include <sched.h> int __sched_cpucount(size_t size, const cpu_set_t *set) { size_t i, j, cnt=0; const unsigned char *p = (const void *)set; for (i=0; i<size; i++) for (j=0; j<8; j++) if (p[i] & (1<<j)<|fim_middle|>) cnt++; return<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#define _GNU_SOURCE #include <errno.h> #include <sched.h> #include <stdint.h> #include <stddef.h> #include "syscall.h" #include "atomic.h" #if defined(__has_feature) #if __has_feature(memory_sanitizer) #include <sanitizer/msan_interface.h> #endif #endif /* Reuse glibc's per-thread rseq registration when...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#define _GNU_SOURC<|fim_suffix|> { return getauxval(AT_SECURE) ? NULL : getenv(name); } <|fim_middle|>E #include <stdlib.h> #include <sys/auxv.h> char * secure_getenv(const char * name)<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <signal.h> #include <string.h> #if (SIGHUP == 1) && (SIGINT == 2) && (SIGQUIT == 3) && (SIGILL == 4) \ && (SIGTRAP == 5) && (SIGABRT == 6) && (SIGBUS == 7) && (SIGFPE == 8) \ && (SIGKILL == 9) && (SIGUSR1 == 10) && (SIGSEGV == 11) && (SIGUSR2 == 12) \ && (SIGPIPE == 13) && (SIGALRM == 14) && ...
fim
ClickHouse/ClickHouse
c
#define _GNU_SOURCE #include <fcntl.h> #include <errno.h> #include "syscall.h" // works same in x86_64 && aarch64 #define __SYSCALL_LL_E(x) (x) #define __SYSCALL_LL_O(x) (x) int sync_file_range(int fd, off_t pos, off_t len, unsigned flags) { #if defined(SYS_sync_file_range2) return syscall(SYS_sync_file_range2, fd, ...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#pragma once #include <sys/syscall.h> #include <syscall_arch.h> typedef long syscall_arg_t; __attribute__((visibility("hidden"))) long __syscall_ret(unsigned long); __attribute__((visibility("hidden"))) long __syscall(syscall_arg_t, ...); __attribute__((visibility("hidden"))) void *__vdsosym(const ch...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <errno.h> #include "syscall.h" long __syscall_ret(unsign<|fim_suffix|>; return -1; } return r; } <|fim_middle|>ed long r) { if (r > -4096UL) { errno = -r<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <sys/timerfd.h> #include "syscall.h" int timerfd_create(int clockid, int flags) { return syscall(SYS_timerfd_create, clockid, flags); } int timerfd_settime(int fd, int flags, const struct itimerspec *new, struct itimerspec *old) { return syscall(SYS_timerfd_settime, fd, flags, new, old)...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#incl<|fim_suffix|>ttime(clockid_t, struct timespec *); /* There is no other implemented value than TIME_UTC; all other values * are considered erroneous. */ int timespec_get(struct timespec * ts, int base) { if (base != TIME_UTC) return 0; int ret = clock_gettime(CLOCK_REALTIME, ts); return ret < 0 ...
fim
ClickHouse/ClickHouse
c
#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> #include <errno.h> #include "syscall.h" #include <syscall.h> int utimensat(int fd, const char *path, const struct timespec times[2], int flags) { int r = __syscall(SYS_utimensat, fd, path, times, flags); #ifdef SYS_futimesat if (r != -ENOSYS || flags) re...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>onst char *fmt, va_list ap) { va_list ap2; va_copy(ap2, ap); int l = vsnprintf(0, 0, fmt, ap2); va_end(ap2); if (l<0 || !(*s=malloc(l+1U))) return -1; return vsnprintf(*s, l+1U, fmt, ap); } <|fim_prefix|>#define _GNU_SOURCE #include <stdio.h> #include <stdarg.h> #include <stdlib.h> <|fim_middle|>i...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <elf.h> #include <link.h> #include <limits.h> #include <stdint.h> #include <string.h> #include <sys/auxv.h> #include "syscall.h" #ifdef VDSO_USEFUL #if ULONG_MAX == 0xffffffff typedef Elf32_Ehdr Ehdr; typedef Elf32_Phdr Phdr; typedef Elf32_Sym Sym; typedef Elf32_Verdef Verdef; typedef Elf32_Ver...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#include <stdint.h> #define a_cas a_cas static inline int a_cas(volatile int *p, int t, int s) { __asm__ __volatile__ ( "lock ; cmpxchg %3, %1" : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); return t; } #define a_cas_p a_cas_p static inline void *a_cas_p(volatile void *p, void *t, void *s) { ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>PU_SYM "__vdso_getcpu" #define VDSO_GETCPU_VER "LINUX_2.6" <|fim_prefix|>#define VDSO_USEFUL #define VDSO_CGT_SYM "__vdso_clock_gettime" #define VDSO_CGT_VER "LINUX_2.6" <|fim_middle|>#define VDSO_GETC<|endoftext|>
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>#ifndef _SP<|fim_suffix|>const char *__restrict, const posix_spawn_file_actions_t *, const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict); #ifdef __cplusplus } #endif #endif <|fim_middle|>AWN_H #define _SPAWN_H #ifdef __cplusplus extern "C" { #endif #include <feature...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>/** This library provides runtime instrumentation (hardening) * that ensures no "harmful" functions from libc are called * (by terminating the program immediately). */ #include <base/sanitizer_defs.h> /// We check for "harmful" functions if it's a debug build or with a sanitizer. #if defined(DEBUG...
fim
ClickHouse/ClickHouse
c
/* * PCG Random Number Generation for C++ * * Copyright 2014-2017 Melissa O'Neill <oneill@pcg-random.org>, * and the PCG Project contributors. * * SPDX-License-Identifier: (Apache-2.0 OR MIT) * * Licensed under the Apache License, Version 2.0 (provided in * LICENSE-APACHE.txt and at http://...
fim
ClickHouse/ClickHouse
cpp
<|fim_prefix|>/* * PCG Random Number Generation for C++ * * Copyright 2014-2017 Melissa O'Neill <oneill@pcg-random.org>, * and the PCG Project contributors. * * SPDX-License-Identifier: (Apache-2.0 OR MIT) * * Licensed under the Apache License, Version 2.0 (provided in * LICENSE-APACHE.txt ...
fim
ClickHouse/ClickHouse
cpp
<|fim_suffix|>r>>(const uint_x4<UInt,UIntX2>& v, const bitcount_t shift) { uint_x4<UInt,UIntX2> r = {0U, 0U, 0U, 0U}; const bitcount_t bits = sizeof(UInt) * CHAR_BIT; const bitcount_t bitmask = bits - 1; const bitcount_t shiftdiv = shift / bits; const bitcount_t sh...
fim
ClickHouse/ClickHouse
cpp
<|fim_prefix|>// // ASCIIEncoding.h // // Library: Foundation // Package: Text // Modul<|fim_suffix|> convert(int ch, unsigned char * bytes, int length) const; int queryConvert(const unsigned char * bytes, int length) const; int sequenceLength(const unsigned char * bytes, int length) const; private: static...
fim
ClickHouse/ClickHouse
c
// // AbstractCache.h // // Library: Foundation // Package: Cache // Module: AbstractCache // // Definition of the AbstractCache class. // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_AbstractCache_INCLUDED #de...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // AbstractDelegate.h // // Library: Foundation // Package: Events // Module: AbstractDelegate // // Implementation of the AbstractDelegate template. // // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef F...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // AbstractEvent.h // // Library: Foundation // Package: Events // Module: AbstractEvent // // Definition of the AbstractEvent class. // // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_Abstra...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // AbstractObserver.h // // Library: Foundation // Package: Notifications // Module: NotificationCenter // // Definition of the AbstractObserver class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // AbstractPriorityDelegate.h // // Library: Foundation // Package: Events // Module: AbstractPriorityDelegate // // Implementation of the AbstractPriorityDelegate template. // // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier...
fim
ClickHouse/ClickHouse
c
// // AbstractStrategy.h // // Library: Foundation // Package: Cache // Module: AbstractCache // // Definition of the AbstractStrategy class. // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_AbstractStrategy_INC...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>e UniqueAccessExpireCache { public: AccessExpirationDecorator() : _value(), _span() { } AccessExpirationDecorator(const TArgs & p, const Poco::Timespan::TimeDiff & diffInMs) : /// Creates an element that will expire in diff milliseconds _value(p) , _span(diffInMs * 1000) ...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>che class. // // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_AccessExpireCache_INCLUDED #define Foundation_AccessExpireCache_INCLUDED #include "Poco/AbstractCache.h" #include "Poco/AccessExpireStra...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>d expire caching. /// It cache entries for a fixed time period (per default 10 minutes) /// but also limits the size of the cache (per default: 1024). { public: AccessExpireLRUCache(long cacheSize = 1024, Timestamp::TimeDiff expire = 600000) : AbstractCache<TKey, TValue, StrategyCollection<TKe...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>class AccessExpireStrategy : public ExpireStrategy<TKey, TValue> /// An AccessExpireStrategy implements time and access based expiration of cache entries { public: AccessExpireStrategy(Timestamp::TimeDiff expireTimeInMilliSec) : ExpireStrategy<TKey, TValue>(expireTimeInMilliSec) /// Create an expi...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> Adds the Runnable to the dispatch queue. void cancel(); /// Cancels all queued methods. protected: void run(); void stop(); private: Thread _thread; NotificationQueue _queue; }; template <> class ActiveStarter<ActiveDispatcher> /// A specialization of ActiveStarter /// for Ac...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> : _pOwner(pOwner), _method(method) /// Creates an ActiveMethod object. { poco_check_ptr(pOwner); } ActiveResultType operator()(void) /// Invokes the ActiveMethod. { ActiveResultType result(new ActiveResultHolder<ResultType>()); ActiveRunnableBase::Ptr pRun...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>Holder->data(pValue); } void wait() /// Pauses the caller until the result becomes available. { _pHolder->wait(); } bool tryWait(long milliseconds) /// Waits up to the specified interval for the result to /// become available. Returns true if the result became ///...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // ActiveRunnable.h // // Library: Foundation // Package: Threading // Module: ActiveObjects // // Definition of the ActiveRunnable class. // // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_A...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // ActiveStarter.h // // Library: Foundation // Package: Threading // Module: ActiveObjects // // Definition of the ActiveStarter class. // // Copyright (c) 2006-2007, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_Act...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // Activity.h // // Library: Foundation // Package: Threading // Module: ActiveObjects // // Definition of the Activity template class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef Foundation_Acti...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // Alignment.h // // Library: Foundation // Package: Dynamic // Module: Alignment // // Definition of the Alignment class. // // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // // Adapted for POCO from LLVM Compiler In...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|> char buf[POCO_SMALL_OBJECT_SIZE] = {0}; return 0 == std::memcmp(_valueHolder.holder, buf, POCO_SMALL_OBJECT_SIZE); } const std::type_info & type() const /// Returns the type information of the stored content. /// If the Any is empty typeid(void) is returned. /// It is recomme...
fim
ClickHouse/ClickHouse
c
<|fim_suffix|>g number is appended to the log file name. { std::string base = pFile->path(); std::string ext = ""; if (base.ends_with(".lz4")) { base.resize(base.size() - 4); ext = ".lz4"; } delete pFile; std::string archPath = base; ...
fim
ClickHouse/ClickHouse
c
<|fim_prefix|>// // Array.h // // Library: Foundation // Package: Core // Module: Array // // Definition of the Array class // // Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // // ---------------------------------------------------...
fim
ClickHouse/ClickHouse
c