From 02d83d01a6014679e6b1bd70f3ed6b6c5b48fe39 Mon Sep 17 00:00:00 2001 From: purplerain Date: Sat, 2 Dec 2023 11:08:21 +0000 Subject: [PATCH] sync with OpenBSD -current --- etc/skel/dot.version | 2 +- lib/libc/db/btree/bt_delete.c | 8 +- lib/libc/db/btree/bt_open.c | 2 +- lib/libc/db/btree/bt_seq.c | 2 +- lib/libc/db/hash/README | 16 ++-- lib/libc/db/hash/hash.h | 22 ++--- lib/libc/db/mpool/mpool.c | 10 +- lib/libc/db/recno/rec_put.c | 2 +- lib/libc/db/recno/rec_search.c | 2 +- lib/libc/db/recno/rec_seq.c | 2 +- lib/libc/dlfcn/dlfcn_stubs.c | 2 +- lib/libc/gen/auth_subr.c | 2 +- lib/libc/gen/confstr.c | 2 +- lib/libc/gen/errlist.c | 4 +- lib/libc/gen/getgrouplist.c | 4 +- lib/libc/gen/isfinite.c | 2 +- lib/libc/gen/isinf.c | 2 +- lib/libc/gen/isnan.c | 2 +- lib/libc/gen/login_cap.c | 18 ++-- lib/libc/gen/modf.c | 10 +- lib/libc/gen/posix_spawn.c | 4 +- lib/libc/gen/scandir.c | 4 +- lib/libc/gen/setmode.c | 4 +- lib/libc/gen/setproctitle.c | 2 +- lib/libc/gen/sysconf.c | 2 +- lib/libc/gen/ualarm.c | 2 +- lib/libc/gen/unvis.c | 30 +++--- lib/libc/gen/vis.c | 4 +- lib/libc/hash/sha2.c | 10 +- lib/libc/hidden/getopt.h | 2 +- lib/libc/hidden/sys/tree.h | 2 +- lib/libc/include/mpool.h | 2 +- lib/libc/locale/setlocale.c | 2 +- lib/libc/locale/wcsxfrm.c | 2 +- lib/libc/locale/wcsxfrm_l.c | 2 +- lib/libc/net/ethers.c | 6 +- lib/libc/net/herror.c | 8 +- lib/libc/net/inet_addr.c | 10 +- lib/libc/net/inet_net_ntop.c | 2 +- lib/libc/net/ip6opt.c | 4 +- lib/libc/net/rcmdsh.c | 16 ++-- lib/libc/net/res_comp.c | 8 +- lib/libc/net/res_data.c | 8 +- lib/libc/net/res_debug_syms.c | 8 +- lib/libc/net/res_random.c | 22 ++--- lib/libc/net/rresvport.c | 2 +- lib/libc/net/rthdr.c | 8 +- lib/libc/net/vars6.c | 4 +- lib/libc/nls/Makefile.inc | 2 +- lib/libc/nls/catclose.c | 2 +- lib/libc/nls/catgets.c | 4 +- lib/libc/nls/catopen.c | 2 +- lib/libc/quad/muldi3.c | 2 +- lib/libc/quad/qdivrem.c | 2 +- lib/libc/softfloat/softfloat.c | 2 +- lib/libc/softfloat/timesoftfloat.c | 2 +- lib/libc/stdio/findfp.c | 4 +- lib/libc/stdio/flags.c | 2 +- lib/libc/stdio/freopen.c | 4 +- lib/libc/stdio/local.h | 2 +- lib/libc/stdio/stdio.c | 4 +- lib/libc/stdio/vfprintf.c | 2 +- lib/libc/stdio/vfwprintf.c | 4 +- lib/libc/stdlib/getsubopt.c | 2 +- lib/libc/stdlib/hcreate.c | 8 +- lib/libc/stdlib/insque.c | 4 +- lib/libc/stdlib/l64a.c | 2 +- lib/libc/stdlib/merge.c | 4 +- lib/libc/stdlib/radixsort.c | 10 +- lib/libc/stdlib/random.c | 16 ++-- lib/libc/stdlib/remque.c | 4 +- lib/libc/string/strsep.c | 2 +- lib/libc/string/wcstok.c | 2 +- lib/libc/sys/Makefile.inc | 2 +- lib/libc/thread/rthread_file.c | 2 +- lib/libc/time/wcsftime.c | 18 ++-- lib/libcbor/Makefile | 2 +- lib/libcbor/src/cbor/cbor_export.h | 6 +- lib/libcbor/src/cbor/configuration.h | 2 +- lib/libcurses/curses.h | 2 +- lib/libevent/min_heap.h | 20 ++-- lib/libexpat/tests/xmltest.sh | 20 ++-- lib/libfido2/man/fido_dev_largeblob_get.3 | 2 +- lib/libfuse/fuse.h | 2 +- lib/libkeynote/HOWTO.add.crypto | 2 +- lib/libkeynote/LICENSE | 4 +- lib/libkeynote/Makefile | 2 +- lib/libkeynote/assertion.h | 10 +- lib/libkeynote/auxil.c | 22 ++--- lib/libkeynote/base64.c | 5 +- lib/libkeynote/environment.c | 36 ++++---- lib/libkeynote/header.h | 4 +- lib/libkeynote/keynote-keygen.c | 4 +- lib/libkeynote/keynote-main.c | 4 +- lib/libkeynote/keynote-sign.c | 6 +- lib/libkeynote/keynote-sigver.c | 4 +- lib/libkeynote/keynote-ver.l | 8 +- lib/libkeynote/keynote-ver.y | 6 +- lib/libkeynote/keynote-verify.c | 10 +- lib/libkeynote/keynote.h | 8 +- lib/libkeynote/keynote.l | 32 +++---- lib/libkeynote/keynote.y | 74 +++++++-------- lib/libkeynote/parse_assertion.c | 26 +++--- lib/libkeynote/sample-app.c | 12 +-- lib/libkeynote/signature.c | 36 ++++---- lib/libkeynote/signature.h | 4 +- lib/libkeynote/testsuite/auth4 | 2 +- lib/libkeynote/testsuite/test-assertion1 | 4 +- .../testsuite/test-assertion1-signed.in | 4 +- lib/libkvm/kvm_file2.c | 2 +- lib/libkvm/kvm_proc2.c | 4 +- lib/libm/arch/i387/e_acos.S | 2 +- lib/libm/arch/i387/e_exp.S | 2 +- lib/libm/arch/i387/s_cos.S | 2 +- lib/libm/arch/i387/s_cosf.S | 2 +- lib/libm/arch/i387/s_llrint.S | 2 +- lib/libm/arch/i387/s_llrintf.S | 2 +- lib/libm/arch/i387/s_log1p.S | 2 +- lib/libm/arch/i387/s_log1pf.S | 2 +- lib/libm/arch/i387/s_lrint.S | 2 +- lib/libm/arch/i387/s_lrintf.S | 2 +- lib/libm/src/e_acos.c | 8 +- lib/libm/src/e_acosf.c | 4 +- lib/libm/src/e_acosh.c | 10 +- lib/libm/src/e_acoshf.c | 8 +- lib/libm/src/e_acosl.c | 2 +- lib/libm/src/e_asin.c | 16 ++-- lib/libm/src/e_asinf.c | 12 +-- lib/libm/src/e_asinl.c | 10 +- lib/libm/src/e_atan2.c | 18 ++-- lib/libm/src/e_atan2f.c | 10 +- lib/libm/src/e_atan2l.c | 4 +- lib/libm/src/e_atanh.c | 8 +- lib/libm/src/e_atanhf.c | 6 +- lib/libm/src/e_cosh.c | 18 ++-- lib/libm/src/e_coshf.c | 6 +- lib/libm/src/e_exp.c | 30 +++--- lib/libm/src/e_expf.c | 8 +- lib/libm/src/e_fmod.c | 12 +-- lib/libm/src/e_fmodf.c | 10 +- lib/libm/src/e_hypot.c | 22 ++--- lib/libm/src/e_hypotf.c | 4 +- lib/libm/src/e_j0.c | 20 ++-- lib/libm/src/e_j0f.c | 12 +-- lib/libm/src/e_j1.c | 24 ++--- lib/libm/src/e_j1f.c | 16 ++-- lib/libm/src/e_jn.c | 40 ++++---- lib/libm/src/e_jnf.c | 26 +++--- lib/libm/src/e_lgamma_r.c | 30 +++--- lib/libm/src/e_lgammaf_r.c | 12 +-- lib/libm/src/e_log.c | 38 ++++---- lib/libm/src/e_log10.c | 10 +- lib/libm/src/e_log10f.c | 2 +- lib/libm/src/e_log2.c | 14 +-- lib/libm/src/e_log2f.c | 4 +- lib/libm/src/e_logf.c | 12 +-- lib/libm/src/e_powf.c | 24 ++--- lib/libm/src/e_rem_pio2.c | 24 ++--- lib/libm/src/e_rem_pio2f.c | 48 +++++----- lib/libm/src/e_remainder.c | 10 +- lib/libm/src/e_remainderf.c | 2 +- lib/libm/src/e_scalb.c | 4 +- lib/libm/src/e_scalbf.c | 2 +- lib/libm/src/e_sinh.c | 14 +-- lib/libm/src/e_sinhf.c | 6 +- lib/libm/src/e_sqrt.c | 92 +++++++++---------- lib/libm/src/e_sqrtf.c | 20 ++-- lib/libm/src/k_cos.c | 16 ++-- lib/libm/src/k_cosf.c | 6 +- lib/libm/src/k_rem_pio2.c | 74 +++++++-------- lib/libm/src/k_rem_pio2f.c | 24 ++--- lib/libm/src/k_sin.c | 16 ++-- lib/libm/src/k_sincos.h | 4 +- lib/libm/src/k_sinf.c | 4 +- lib/libm/src/k_tanf.c | 6 +- lib/libm/src/ld128/e_fmodl.c | 4 +- lib/libm/src/ld128/invtrig.c | 4 +- lib/libm/src/ld128/k_cosl.c | 2 +- lib/libm/src/ld128/k_sincosl.h | 6 +- lib/libm/src/ld128/k_sinl.c | 2 +- lib/libm/src/ld128/s_ilogbl.c | 4 +- lib/libm/src/ld128/s_remquol.c | 2 +- lib/libm/src/ld80/k_sincosl.h | 2 +- lib/libm/src/ld80/s_ilogbl.c | 4 +- lib/libm/src/math_private.h | 2 +- lib/libm/src/s_asinh.c | 14 +-- lib/libm/src/s_asinhf.c | 10 +- lib/libm/src/s_atan.c | 14 +-- lib/libm/src/s_atanf.c | 8 +- lib/libm/src/s_cbrt.c | 10 +- lib/libm/src/s_cbrtf.c | 10 +- lib/libm/src/s_ceil.c | 6 +- lib/libm/src/s_ceilf.c | 4 +- lib/libm/src/s_clog.c | 2 +- lib/libm/src/s_copysign.c | 2 +- lib/libm/src/s_copysignf.c | 2 +- lib/libm/src/s_cos.c | 8 +- lib/libm/src/s_cosf.c | 2 +- lib/libm/src/s_cosl.c | 4 +- lib/libm/src/s_erf.c | 30 +++--- lib/libm/src/s_erff.c | 12 +-- lib/libm/src/s_exp2.c | 2 +- lib/libm/src/s_exp2f.c | 4 +- lib/libm/src/s_expm1.c | 46 +++++----- lib/libm/src/s_expm1f.c | 8 +- lib/libm/src/s_fabsf.c | 2 +- lib/libm/src/s_floor.c | 6 +- lib/libm/src/s_floorf.c | 4 +- lib/libm/src/s_frexpf.c | 2 +- lib/libm/src/s_ilogb.c | 4 +- lib/libm/src/s_ilogbf.c | 4 +- lib/libm/src/s_log1p.c | 40 ++++---- lib/libm/src/s_log1pf.c | 12 +-- lib/libm/src/s_logb.c | 6 +- lib/libm/src/s_logbf.c | 6 +- lib/libm/src/s_modff.c | 2 +- lib/libm/src/s_nextafter.c | 4 +- lib/libm/src/s_nextafterf.c | 10 +- lib/libm/src/s_remquo.c | 6 +- lib/libm/src/s_remquof.c | 2 +- lib/libm/src/s_rint.c | 4 +- lib/libm/src/s_rintf.c | 4 +- lib/libm/src/s_scalbn.c | 8 +- lib/libm/src/s_scalbnf.c | 6 +- lib/libm/src/s_significand.c | 2 +- lib/libm/src/s_significandf.c | 2 +- lib/libm/src/s_sin.c | 8 +- lib/libm/src/s_sincos.c | 2 +- lib/libm/src/s_sinf.c | 2 +- lib/libm/src/s_sinl.c | 2 +- lib/libm/src/s_tan.c | 8 +- lib/libm/src/s_tanf.c | 2 +- lib/libm/src/s_tanh.c | 4 +- lib/libm/src/s_tanhf.c | 4 +- lib/libm/src/s_tanl.c | 2 +- lib/libm/src/w_drem.c | 2 +- lib/libm/src/w_dremf.c | 2 +- lib/libm/src/w_gamma.c | 4 +- lib/libm/src/w_gamma_r.c | 6 +- lib/libm/src/w_gammaf.c | 2 +- lib/libm/src/w_gammaf_r.c | 4 +- lib/libm/src/w_lgamma.c | 2 +- lib/libm/src/w_lgammaf.c | 2 +- lib/libossaudio/ossaudio.c | 4 +- lib/libpcap/gencode.c | 4 +- lib/libpcap/gencode.h | 2 +- lib/libpcap/inet.c | 2 +- lib/libpcap/nametoaddr.c | 2 +- lib/libpcap/optimize.c | 8 +- lib/libpcap/pcap-int.h | 2 +- lib/libpcap/pcap.c | 4 +- lib/libpcap/savefile.c | 2 +- lib/libpcap/scanner.l | 2 +- lib/libradius/radius_eapmsk.c | 2 +- lib/librthread/rthread.c | 2 +- lib/librthread/rthread_attr.c | 2 +- lib/librthread/rthread_mutexattr.c | 2 +- lib/librthread/rthread_np.c | 2 +- lib/librthread/rthread_rwlockattr.c | 4 +- lib/libssl/LICENSE | 16 ++-- lib/libssl/bytestring.h | 2 +- lib/libssl/pqueue.h | 4 +- lib/libssl/ssl_clnt.c | 2 +- lib/libssl/test/cms-test.pl | 6 +- lib/libssl/test/pkits-test.pl | 2 +- lib/libssl/test/test.cnf | 2 +- lib/libssl/test/test_aesni | 2 +- lib/libssl/test/testtsa | 4 +- lib/libssl/test/times | 2 +- lib/libusbhid/parse.c | 2 +- lib/libutil/ber.c | 2 +- lib/libutil/ohash.h | 2 +- sys/dev/pv/virtio.c | 14 ++- sys/dev/pv/virtiovar.h | 6 +- sys/net/pipex.c | 10 +- 275 files changed, 1129 insertions(+), 1124 deletions(-) diff --git a/etc/skel/dot.version b/etc/skel/dot.version index 3cd29a32d..2db7a434c 100644 --- a/etc/skel/dot.version +++ b/etc/skel/dot.version @@ -1 +1 @@ -# SecBSD 1.4-8cd59e6: Fri Nov 24 03:25:50 UTC 2023 (Mictlantecuhtli) +# SecBSD 1.4-a5839ef: Fri Dec 1 14:35:24 UTC 2023 (Mictlantecuhtli) diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c index 31c97ecf7..b9f45aa10 100644 --- a/lib/libc/db/btree/bt_delete.c +++ b/lib/libc/db/btree/bt_delete.c @@ -142,7 +142,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c) pgno_t pgno; recno_t nextpg, prevpg; int exact, level; - + /* * Find the first occurrence of the key in the tree. Toss the * currently locked page so we don't hit an already-locked page. @@ -258,7 +258,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c) if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) return (1); } - + ret: mpool_put(t->bt_mp, h, 0); return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL); @@ -386,7 +386,7 @@ __bt_pdelete(BTREE *t, PAGE *h) /* Get the parent page. */ if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - + idx = parent->index; bi = GETBINTERNAL(pg, idx); @@ -547,7 +547,7 @@ __bt_curdel(BTREE *t, const DBT *key, PAGE *h, u_int idx) key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (idx > 0) { + if (idx > 0) { e.page = h; e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c index f8ea301f1..48fda626c 100644 --- a/lib/libc/db/btree/bt_open.c +++ b/lib/libc/db/btree/bt_open.c @@ -189,7 +189,7 @@ __bt_open(const char *fname, int flags, int mode, const BTREEINFO *openinfo, default: goto einval; } - + if ((t->bt_fd = open(fname, flags | O_CLOEXEC, mode)) < 0) goto err; diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c index 6da92a64c..79539df90 100644 --- a/lib/libc/db/btree/bt_seq.c +++ b/lib/libc/db/btree/bt_seq.c @@ -344,7 +344,7 @@ __bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp) *erval = *ep; return (RET_SUCCESS); } - + /* * Walk backwards, as long as the entry matches and there are * keys left in the tree. Save a copy of each match in case diff --git a/lib/libc/db/hash/README b/lib/libc/db/hash/README index 37358020c..e89a8f877 100644 --- a/lib/libc/db/hash/README +++ b/lib/libc/db/hash/README @@ -6,17 +6,17 @@ Test Programs: All test programs which need key/data pairs expect them entered with key and data on separate lines - tcreat3.c - Takes - bucketsize (bsize), + tcreat3.c + Takes + bucketsize (bsize), fill factor (ffactor), and - initial number of elements (nelem). - Creates a hash table named hashtest containing the + initial number of elements (nelem). + Creates a hash table named hashtest containing the keys/data pairs entered from standard in. thash4.c Takes - bucketsize (bsize), - fill factor (ffactor), + bucketsize (bsize), + fill factor (ffactor), initial number of elements (nelem) bytes of cache (ncached), and file from which to read data (fname) @@ -59,7 +59,7 @@ file, you may lose updates since the package buffers all writes. Also, the db interface only creates a single database file. To avoid overwriting the user's original file, the suffix ".db" is appended to the file name passed to dbm_open. Additionally, if your code "knows" about the historic -.dir and .pag files, it will break. +.dir and .pag files, it will break. There is a fundamental difference between this package and the old hsearch. Hsearch requires the user to maintain the keys and data in the application's diff --git a/lib/libc/db/hash/hash.h b/lib/libc/db/hash/hash.h index 4486f6b20..f9ba2f65b 100644 --- a/lib/libc/db/hash/hash.h +++ b/lib/libc/db/hash/hash.h @@ -69,28 +69,28 @@ typedef struct hashhdr { /* Disk resident portion */ int32_t dsize; /* Directory Size */ int32_t ssize; /* Segment Size */ int32_t sshift; /* Segment shift */ - int32_t ovfl_point; /* Where overflow pages are being + int32_t ovfl_point; /* Where overflow pages are being * allocated */ int32_t last_freed; /* Last overflow page freed */ int32_t max_bucket; /* ID of Maximum bucket in use */ int32_t high_mask; /* Mask to modulo into entire table */ - int32_t low_mask; /* Mask to modulo into lower half of + int32_t low_mask; /* Mask to modulo into lower half of * table */ int32_t ffactor; /* Fill factor */ int32_t nkeys; /* Number of keys in hash table */ int32_t hdrpages; /* Size of table header */ int32_t h_charkey; /* value of hash(CHARKEY) */ -#define NCACHED 32 /* number of bit maps and spare +#define NCACHED 32 /* number of bit maps and spare * points */ int32_t spares[NCACHED];/* spare pages for overflow */ - u_int16_t bitmaps[NCACHED]; /* address of overflow page + u_int16_t bitmaps[NCACHED]; /* address of overflow page * bitmaps */ } HASHHDR; typedef struct htab { /* Memory resident data structure */ HASHHDR hdr; /* Header */ int nsegs; /* Number of allocated segments */ - int exsegs; /* Number of extra allocated + int exsegs; /* Number of extra allocated * segments */ u_int32_t /* Hash function */ (*hash)(const void *, size_t); @@ -101,16 +101,16 @@ typedef struct htab { /* Memory resident data structure */ BUFHEAD *cpage; /* Current page */ int cbucket; /* Current bucket */ int cndx; /* Index of next item on cpage */ - int err; /* Error Number -- for DBM + int err; /* Error Number -- for DBM * compatibility */ - int new_file; /* Indicates if fd is backing store + int new_file; /* Indicates if fd is backing store * or no */ - int save_file; /* Indicates whether we need to flush + int save_file; /* Indicates whether we need to flush * file at * exit */ u_int32_t *mapp[NCACHED]; /* Pointers to page maps */ int nmaps; /* Initial number of bitmaps */ - int nbufs; /* Number of buffers left to + int nbufs; /* Number of buffers left to * allocate */ BUFHEAD bufhead; /* Header of buffer lru list */ SEGMENT *dir; /* Hash Bucket directory */ @@ -192,7 +192,7 @@ typedef struct htab { /* Memory resident data structure */ * so it starts on this page and continues on the next. * The format of the page is: * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE - * + * * KEY_OFF -- offset of the beginning of the key * PARTIAL_KEY -- 1 * OVFL_PAGENO - page number of the next overflow page @@ -227,7 +227,7 @@ typedef struct htab { /* Memory resident data structure */ * OVFL_PAGENO - page number of the next overflow page * OVFLPAGE -- 0 * - * FULL_KEY_DATA + * FULL_KEY_DATA * This must be the first key/data pair on the page. * There are two cases: * diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c index a19b2d625..1672f398b 100644 --- a/lib/libc/db/mpool/mpool.c +++ b/lib/libc/db/mpool/mpool.c @@ -96,7 +96,7 @@ mpool_filter(MPOOL *mp, void (*pgin) (void *, pgno_t, void *), mp->pgout = pgout; mp->pgcookie = pgcookie; } - + /* * mpool_new -- * Get a new page of memory. @@ -159,8 +159,8 @@ mpool_delete(MPOOL *mp, void *page) free(bp); mp->curcache--; return (RET_SUCCESS); -} - +} + /* * mpool_get * Get a page. @@ -457,7 +457,7 @@ mpool_stat(MPOOL *mp) mp->pagealloc, mp->pageflush); if (mp->cachehit + mp->cachemiss) (void)fprintf(stderr, - "%.0f%% cache hit rate (%lu hits, %lu misses)\n", + "%.0f%% cache hit rate (%lu hits, %lu misses)\n", ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, mp->cachemiss); (void)fprintf(stderr, "%lu page reads, %lu page writes\n", @@ -476,7 +476,7 @@ mpool_stat(MPOOL *mp) cnt = 0; } else sep = ", "; - + } (void)fprintf(stderr, "\n"); } diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c index 2440927a5..9075fdf8a 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -160,7 +160,7 @@ einval: errno = EINVAL; if (flags == R_SETCURSOR) t->bt_cursor.rcursor = nrec; - + F_SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } diff --git a/lib/libc/db/recno/rec_search.c b/lib/libc/db/recno/rec_search.c index a609ca4f4..f0738b858 100644 --- a/lib/libc/db/recno/rec_search.c +++ b/lib/libc/db/recno/rec_search.c @@ -83,7 +83,7 @@ __rec_search(BTREE *t, recno_t recno, enum SRCHOP op) } BT_PUSH(t, pg, idx - 1); - + pg = r->pgno; switch (op) { case SDELETE: diff --git a/lib/libc/db/recno/rec_seq.c b/lib/libc/db/recno/rec_seq.c index cf193aa19..5129e7452 100644 --- a/lib/libc/db/recno/rec_seq.c +++ b/lib/libc/db/recno/rec_seq.c @@ -98,7 +98,7 @@ __rec_seq(const DB *dbp, DBT *key, DBT *data, u_int flags) einval: errno = EINVAL; return (RET_ERROR); } - + if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) { if (!F_ISSET(t, R_EOF | R_INMEM) && (status = t->bt_irec(t, nrec)) != RET_SUCCESS) diff --git a/lib/libc/dlfcn/dlfcn_stubs.c b/lib/libc/dlfcn/dlfcn_stubs.c index 551de116b..2ebc20657 100644 --- a/lib/libc/dlfcn/dlfcn_stubs.c +++ b/lib/libc/dlfcn/dlfcn_stubs.c @@ -2,7 +2,7 @@ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c index e28a55e7e..cda1f1b7f 100644 --- a/lib/libc/gen/auth_subr.c +++ b/lib/libc/gen/auth_subr.c @@ -102,7 +102,7 @@ struct auth_session_t { int state; /* authenticated state */ struct rmfiles *rmlist; /* list of files to remove on failure */ - struct authopts *optlist; /* list of options to scripts */ + struct authopts *optlist; /* list of options to scripts */ struct authdata *data; /* additional data to send to scripts */ char spool[MAXSPOOLSIZE]; /* data returned from login script */ diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c index 0023a5e64..8f03e2137 100644 --- a/lib/libc/gen/confstr.c +++ b/lib/libc/gen/confstr.c @@ -115,7 +115,7 @@ confstr(int name, char *buf, size_t len) case _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: return (strlcpy(buf, v6_width_restricted_envs, len) + 1); - + case _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: return (strlcpy(buf, v7_width_restricted_envs, len) + 1); diff --git a/lib/libc/gen/errlist.c b/lib/libc/gen/errlist.c index f5480a6af..5ae895177 100644 --- a/lib/libc/gen/errlist.c +++ b/lib/libc/gen/errlist.c @@ -153,5 +153,5 @@ DEF_WEAK(sys_errlist); DEF_WEAK(sys_nerr); #endif -__strong_alias(_sys_errlist, sys_errlist); -__strong_alias(_sys_nerr, sys_nerr); +__strong_alias(_sys_errlist, sys_errlist); +__strong_alias(_sys_nerr, sys_nerr); diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index b23b937fa..6f80a2412 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -56,7 +56,7 @@ static int _read_netid(const char *, uid_t, gid_t*, int*, int); /* * Parse one string of the form "uid:gid[,gid[,...]]". * If the uid matches, add the groups to the group list. - * If the groups fit, return 1, otherwise return -1. + * If the groups fit, return 1, otherwise return -1. * If the uid does not match, return 0. */ static int @@ -116,7 +116,7 @@ _read_netid(const char *key, uid_t uid, gid_t *groups, int *ngroups, int found = 0; fp = fopen(_PATH_NETID, "re"); - if (!fp) + if (!fp) return (0); while (!found && fgets(line, sizeof(line), fp)) { p = strchr(line, '\n'); diff --git a/lib/libc/gen/isfinite.c b/lib/libc/gen/isfinite.c index 9849be98e..346429f50 100644 --- a/lib/libc/gen/isfinite.c +++ b/lib/libc/gen/isfinite.c @@ -40,7 +40,7 @@ __isfinitef(float f) __strong_alias(__isfinitel, __isfinite); #endif /* LDBL_MANT_DIG == DBL_MANT_DIG */ -/* +/* * 3BSD compatibility aliases. */ __strong_alias(finite, __isfinite); diff --git a/lib/libc/gen/isinf.c b/lib/libc/gen/isinf.c index ad2604959..b8bd5d589 100644 --- a/lib/libc/gen/isinf.c +++ b/lib/libc/gen/isinf.c @@ -33,7 +33,7 @@ int __isinff(float f) { struct ieee_single *p = (struct ieee_single *)&f; - + return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac == 0); } diff --git a/lib/libc/gen/isnan.c b/lib/libc/gen/isnan.c index 5ee34be7f..061e01d05 100644 --- a/lib/libc/gen/isnan.c +++ b/lib/libc/gen/isnan.c @@ -33,7 +33,7 @@ int __isnanf(float f) { struct ieee_single *p = (struct ieee_single *)&f; - + return (p->sng_exp == SNG_EXP_INFNAN && p->sng_frac != 0); } diff --git a/lib/libc/gen/login_cap.c b/lib/libc/gen/login_cap.c index 1460181b3..b60228b7c 100644 --- a/lib/libc/gen/login_cap.c +++ b/lib/libc/gen/login_cap.c @@ -112,7 +112,7 @@ login_getclass(char *class) if ((res = cgetent(&lc->lc_cap, classfiles, lc->lc_class)) != 0) { lc->lc_cap = 0; switch (res) { - case 1: + case 1: syslog(LOG_ERR, "%s: couldn't resolve 'tc'", lc->lc_class); break; @@ -198,7 +198,7 @@ login_getstyle(login_cap_t *lc, char *style, char *atype) if (!style) style = authtypes[0]; - + while (*authtypes && strcmp(style, *authtypes)) ++authtypes; @@ -272,7 +272,7 @@ login_getcaptime(login_cap_t *lc, char *cap, quad_t def, quad_t e) errno = ERANGE; return (e); default: - if (stat >= 0) + if (stat >= 0) break; free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", @@ -357,7 +357,7 @@ login_getcapnum(login_cap_t *lc, char *cap, quad_t def, quad_t e) errno = ERANGE; return (e); default: - if (stat >= 0) + if (stat >= 0) break; free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", @@ -411,7 +411,7 @@ login_getcapsize(login_cap_t *lc, char *cap, quad_t def, quad_t e) errno = ERANGE; return (e); default: - if (stat >= 0) + if (stat >= 0) break; free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", @@ -619,7 +619,7 @@ setusercontext(login_cap_t *lc, struct passwd *pwd, uid_t uid, u_int flags) } if (flags & LOGIN_SETRESOURCES) - for (i = 0; r_list[i].name; ++i) + for (i = 0; r_list[i].name; ++i) if (gsetrl(lc, r_list[i].what, r_list[i].name, r_list[i].type)) /* XXX - call syslog()? */; @@ -744,7 +744,7 @@ setuserpath(login_cap_t *lc, const struct passwd *pwd) *np++ = *op++; break; } - + } *np = '\0'; setit: @@ -952,9 +952,9 @@ multiply(u_quad_t n1, u_quad_t n2) * is not done then the first multiply below may overflow.) */ for (b1 = bpw; (((u_quad_t)1 << (b1-1)) & n1) == 0; --b1) - ; + ; for (b2 = bpw; (((u_quad_t)1 << (b2-1)) & n2) == 0; --b2) - ; + ; if (b1 + b2 - 2 > bpw) { errno = ERANGE; return (UQUAD_MAX); diff --git a/lib/libc/gen/modf.c b/lib/libc/gen/modf.c index e02e8c106..645a354b3 100644 --- a/lib/libc/gen/modf.c +++ b/lib/libc/gen/modf.c @@ -6,17 +6,17 @@ * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index f863ebc1e..1a4ed1e70 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -187,7 +187,7 @@ process_file_actions(const posix_spawn_file_actions_t fa) if (error) return (error); } - return (0); + return (0); } static int @@ -197,7 +197,7 @@ do_posix_spawn(pid_t *pid, const char *path, char *const argv[], char *const envp[], int use_env_path) { pid_t p; - + p = fork(); switch (p) { case -1: diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c index 870dc0a39..9782a3d91 100644 --- a/lib/libc/gen/scandir.c +++ b/lib/libc/gen/scandir.c @@ -75,7 +75,7 @@ scandir(const char *dirname, struct dirent ***namelist, /* * estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. + * and dividing it by a multiple of the minimum size entry. */ arraysz = MAXIMUM(stb.st_size / 24, 16); if (arraysz > SIZE_MAX / sizeof(struct dirent *)) { @@ -96,7 +96,7 @@ scandir(const char *dirname, struct dirent ***namelist, */ if (nitems >= arraysz) { struct dirent **nnames; - + if (fstat(dirp->dd_fd, &stb) == -1) goto fail; diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c index ce241d20b..80949d655 100644 --- a/lib/libc/gen/setmode.c +++ b/lib/libc/gen/setmode.c @@ -186,7 +186,7 @@ setmode(const char *p) (void)sigprocmask(SIG_SETMASK, &sigoset, NULL); setlen = SET_LEN + 2; - + if ((set = calloc((u_int)sizeof(BITCMD), setlen)) == NULL) return (NULL); saveset = set; @@ -366,7 +366,7 @@ addcmd(BITCMD *set, int op, int who, int oparg, u_int mask) set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS; set->bits = mask; } - + if (oparg == '+') set->cmd2 |= CMD2_SET; else if (oparg == '-') diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index f76327852..60325ad30 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -46,7 +46,7 @@ setproctitle(const char *fmt, ...) { static struct ps_strings *ps; va_list ap; - + static char buf[MAX_PROCTITLE], *bufp = buf; int used; diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index de3649331..51cb74850 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -473,6 +473,6 @@ sysconf(int name) errno = EINVAL; return (-1); } - return (sysctl(mib, namelen, &value, &len, NULL, 0) == -1 ? -1 : value); + return (sysctl(mib, namelen, &value, &len, NULL, 0) == -1 ? -1 : value); } DEF_WEAK(sysconf); diff --git a/lib/libc/gen/ualarm.c b/lib/libc/gen/ualarm.c index 8c19589dd..1a2b00179 100644 --- a/lib/libc/gen/ualarm.c +++ b/lib/libc/gen/ualarm.c @@ -46,7 +46,7 @@ ualarm(useconds_t usecs, useconds_t reload) new.it_interval.tv_usec = reload % USPS; new.it_interval.tv_sec = reload / USPS; - + new.it_value.tv_usec = usecs % USPS; new.it_value.tv_sec = usecs / USPS; diff --git a/lib/libc/gen/unvis.c b/lib/libc/gen/unvis.c index 05749aa2c..6e485d2c1 100644 --- a/lib/libc/gen/unvis.c +++ b/lib/libc/gen/unvis.c @@ -56,7 +56,7 @@ unvis(char *cp, char c, int *astate, int flag) if (*astate == S_OCTAL2 || *astate == S_OCTAL3) { *astate = S_GROUND; return (UNVIS_VALID); - } + } return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD); } @@ -67,7 +67,7 @@ unvis(char *cp, char c, int *astate, int flag) if (c == '\\') { *astate = S_START; return (0); - } + } *cp = c; return (UNVIS_VALID); @@ -145,7 +145,7 @@ unvis(char *cp, char c, int *astate, int flag) } *astate = S_GROUND; return (UNVIS_SYNBAD); - + case S_META: if (c == '-') *astate = S_META1; @@ -156,12 +156,12 @@ unvis(char *cp, char c, int *astate, int flag) return (UNVIS_SYNBAD); } return (0); - + case S_META1: *astate = S_GROUND; *cp |= c; return (UNVIS_VALID); - + case S_CTRL: if (c == '?') *cp |= 0177; @@ -172,15 +172,15 @@ unvis(char *cp, char c, int *astate, int flag) case S_OCTAL2: /* second possible octal digit */ if (isoctal(c)) { - /* - * yes - and maybe a third + /* + * yes - and maybe a third */ *cp = (*cp << 3) + (c - '0'); - *astate = S_OCTAL3; + *astate = S_OCTAL3; return (0); - } - /* - * no - done with current sequence, push back passed char + } + /* + * no - done with current sequence, push back passed char */ *astate = S_GROUND; return (UNVIS_VALIDPUSH); @@ -196,9 +196,9 @@ unvis(char *cp, char c, int *astate, int flag) */ return (UNVIS_VALIDPUSH); - default: - /* - * decoder in unknown state - (probably uninitialized) + default: + /* + * decoder in unknown state - (probably uninitialized) */ *astate = S_GROUND; return (UNVIS_SYNBAD); @@ -207,7 +207,7 @@ unvis(char *cp, char c, int *astate, int flag) DEF_WEAK(unvis); /* - * strunvis - decode src into dst + * strunvis - decode src into dst * * Number of chars decoded into dst is returned, -1 on error. * Dst is null terminated. diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index 6f7b501f8..af1f67b12 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -169,10 +169,10 @@ DEF_WEAK(vis); /* * strvis, strnvis, strvisx - visually encode characters from src into dst - * + * * Dst must be 4 times the size of src to account for possible * expansion. The length of dst, not including the trailing NULL, - * is returned. + * is returned. * * Strnvis will write no more than siz-1 bytes (and will NULL terminate). * The number of bytes needed to fully encode the string is returned. diff --git a/lib/libc/hash/sha2.c b/lib/libc/hash/sha2.c index a756ec79b..358b36b6e 100644 --- a/lib/libc/hash/sha2.c +++ b/lib/libc/hash/sha2.c @@ -3,7 +3,7 @@ /* * FILE: sha2.c * AUTHOR: Aaron D. Gifford - * + * * Copyright (c) 2000-2001, Aaron D. Gifford * All rights reserved. * @@ -18,7 +18,7 @@ * 3. Neither the name of the copyright holder nor the names of contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -75,7 +75,7 @@ * * And for little-endian machines, add: * - * #define BYTE_ORDER LITTLE_ENDIAN + * #define BYTE_ORDER LITTLE_ENDIAN * * Or for big-endian machines: * @@ -471,11 +471,11 @@ SHA256Transform(u_int32_t state[8], const u_int8_t data[SHA256_BLOCK_LENGTH]) /* Part of the message block expansion: */ s0 = W256[(j+1)&0x0f]; s0 = sigma0_256(s0); - s1 = W256[(j+14)&0x0f]; + s1 = W256[(j+14)&0x0f]; s1 = sigma1_256(s1); /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); T2 = Sigma0_256(a) + Maj(a, b, c); h = g; diff --git a/lib/libc/hidden/getopt.h b/lib/libc/hidden/getopt.h index 69bbe9244..269959e81 100644 --- a/lib/libc/hidden/getopt.h +++ b/lib/libc/hidden/getopt.h @@ -33,5 +33,5 @@ extern PROTO_NORMAL(optreset); PROTO_DEPRECATED(getopt); PROTO_DEPRECATED(getopt_long); PROTO_DEPRECATED(getopt_long_only); - + #endif /* !_LIBC_GETOPT_H_ */ diff --git a/lib/libc/hidden/sys/tree.h b/lib/libc/hidden/sys/tree.h index 91f2563a2..b49a40418 100644 --- a/lib/libc/hidden/sys/tree.h +++ b/lib/libc/hidden/sys/tree.h @@ -1,6 +1,6 @@ /* $OpenBSD: tree.h,v 1.1 2017/06/19 03:06:26 dlg Exp $ */ -/* +/* * Copyright (c) 2016 David Gwynne * * Permission to use, copy, modify, and distribute this software for any diff --git a/lib/libc/include/mpool.h b/lib/libc/include/mpool.h index 005b006d1..374a3576f 100644 --- a/lib/libc/include/mpool.h +++ b/lib/libc/include/mpool.h @@ -32,7 +32,7 @@ * @(#)mpool.h 8.4 (Berkeley) 11/2/95 */ -#ifndef _MPOOL_H_ +#ifndef _MPOOL_H_ #define _MPOOL_H_ #include diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c index 08027ed7e..da5e2fe25 100644 --- a/lib/libc/locale/setlocale.c +++ b/lib/libc/locale/setlocale.c @@ -39,7 +39,7 @@ dupgl(char **oldgl) char **newgl; int ic; - if ((newgl = calloc(_LC_LAST, sizeof(*newgl))) == NULL) + if ((newgl = calloc(_LC_LAST, sizeof(*newgl))) == NULL) return NULL; for (ic = LC_ALL; ic < _LC_LAST; ic++) { if ((newgl[ic] = strdup(ic == LC_ALL ? "" : diff --git a/lib/libc/locale/wcsxfrm.c b/lib/libc/locale/wcsxfrm.c index 3d1e5803f..19b1825ae 100644 --- a/lib/libc/locale/wcsxfrm.c +++ b/lib/libc/locale/wcsxfrm.c @@ -32,7 +32,7 @@ #include -size_t +size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n) { if (n == 0) diff --git a/lib/libc/locale/wcsxfrm_l.c b/lib/libc/locale/wcsxfrm_l.c index 1b7925dc8..ae0137cee 100644 --- a/lib/libc/locale/wcsxfrm_l.c +++ b/lib/libc/locale/wcsxfrm_l.c @@ -6,7 +6,7 @@ #include -size_t +size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale __attribute__((__unused__))) { diff --git a/lib/libc/net/ethers.c b/lib/libc/net/ethers.c index d62be1ca7..f8dfe01ca 100644 --- a/lib/libc/net/ethers.c +++ b/lib/libc/net/ethers.c @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* +/* * ethers(3) a la Sun. * Originally Written by Roland McGrath 10/14/93. * Substantially modified by Todd C. Miller @@ -92,7 +92,7 @@ ether_aton(const char *s) int ether_ntohost(char *hostname, struct ether_addr *e) { - FILE *f; + FILE *f; char buf[BUFSIZ+1], *p; size_t len; struct ether_addr try; @@ -115,7 +115,7 @@ ether_ntohost(char *hostname, struct ether_addr *e) memcmp(&try, e, sizeof(try)) == 0) { (void)fclose(f); return (0); - } + } } (void)fclose(f); errno = ENOENT; diff --git a/lib/libc/net/herror.c b/lib/libc/net/herror.c index 356c85fa1..901b34d8a 100644 --- a/lib/libc/net/herror.c +++ b/lib/libc/net/herror.c @@ -5,7 +5,7 @@ * - * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * 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 appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT diff --git a/lib/libc/net/inet_addr.c b/lib/libc/net/inet_addr.c index 62d46ad66..00272f5d9 100644 --- a/lib/libc/net/inet_addr.c +++ b/lib/libc/net/inet_addr.c @@ -5,7 +5,7 @@ * - * Copyright (c) 1983, 1990, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * 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 appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -70,7 +70,7 @@ inet_addr(const char *cp) return (INADDR_NONE); } -/* +/* * Check whether "cp" is a valid ascii representation * of an Internet address and convert to a binary address. * Returns 1 if the address is valid, 0 if not. diff --git a/lib/libc/net/inet_net_ntop.c b/lib/libc/net/inet_net_ntop.c index 1f1c4bed1..50545c671 100644 --- a/lib/libc/net/inet_net_ntop.c +++ b/lib/libc/net/inet_net_ntop.c @@ -153,7 +153,7 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) ret = snprintf(dst, size, "%s/%d", buf, bits); if (ret < 0 || ret >= size) { errno = EMSGSIZE; - return (NULL); + return (NULL); } return (dst); diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c index 383748944..ff76d423d 100644 --- a/lib/libc/net/ip6opt.c +++ b/lib/libc/net/ip6opt.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c index 66caac3f3..7ec3a39d1 100644 --- a/lib/libc/net/rcmdsh.c +++ b/lib/libc/net/rcmdsh.c @@ -1,20 +1,20 @@ -/* $OpenBSD: rcmdsh.c,v 1.20 2019/06/28 13:32:42 deraadt Exp $ */ +/* $OpenBSD: rcmdsh.c,v 1.20 2019/06/28 13:32:42 deraadt Exp $ */ /* * Copyright (c) 2001, MagniComp * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * 1. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the distribution. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. * 3. Neither the name of the MagniComp nor the names of its contributors may * be used to endorse or promote products derived from this software - * without specific prior written permission. + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -29,7 +29,7 @@ */ /* - * This is an rcmd() replacement originally by + * This is an rcmd() replacement originally by * Chris Siebenmann . */ diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c index ce9f92ae7..602a6fe13 100644 --- a/lib/libc/net/res_comp.c +++ b/lib/libc/net/res_comp.c @@ -5,7 +5,7 @@ * - * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * 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 appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT diff --git a/lib/libc/net/res_data.c b/lib/libc/net/res_data.c index 6e81b584a..c2a1fc81b 100644 --- a/lib/libc/net/res_data.c +++ b/lib/libc/net/res_data.c @@ -5,7 +5,7 @@ * - * Copyright (c) 1995 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * 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 appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT diff --git a/lib/libc/net/res_debug_syms.c b/lib/libc/net/res_debug_syms.c index fc26f03e7..c03df4b89 100644 --- a/lib/libc/net/res_debug_syms.c +++ b/lib/libc/net/res_debug_syms.c @@ -5,7 +5,7 @@ * - * Copyright (c) 1985, 1990, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * 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 appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT diff --git a/lib/libc/net/res_random.c b/lib/libc/net/res_random.c index 3f642a138..e8ee43fe0 100644 --- a/lib/libc/net/res_random.c +++ b/lib/libc/net/res_random.c @@ -36,7 +36,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* * seed = random 15bit * n = prime, g0 = generator to n, * j = random so that gcd(j,n-1) == 1 @@ -44,7 +44,7 @@ * * X[0] = random seed. * X[n] = a*X[n-1]+b mod m is a Linear Congruential Generator - * with a = 7^(even random) mod m, + * with a = 7^(even random) mod m, * b = random with gcd(b,m) == 1 * m = 31104 and a maximal period of m-1. * @@ -88,7 +88,7 @@ struct prf_ctx { #define PFAC_N 3 static const u_int16_t pfacts[PFAC_N] = { - 2, + 2, 3, 2729 }; @@ -161,15 +161,15 @@ permute15(u_int in) return (right << 8) | left; } -/* - * Initializes the seed and chooses a suitable generator. Also toggles +/* + * Initializes the seed and chooses a suitable generator. Also toggles * the msb flag. The msb flag is used to generate two distinct * cycles of random numbers and thus avoiding reuse of ids. * - * This function is called from res_randomid() when needed, an + * This function is called from res_randomid() when needed, an * application does not have to worry about it. */ -static void +static void res_initid(void) { u_int16_t j, i; @@ -190,10 +190,10 @@ res_initid(void) ru_a = pmod(RU_AGEN, (tmp >> 16) & 0xfffe, RU_M); while (ru_b % 3 == 0) ru_b += 2; - + j = arc4random_uniform(RU_N); - /* + /* * Do a fast gcd(j,RU_N-1), so we can find a j with * gcd(j, RU_N-1) == 1, giving a new generator for * RU_GEN^j mod RU_N @@ -206,7 +206,7 @@ res_initid(void) if (i >= PFAC_N) noprime = 0; - else + else j = (j + 1) % RU_N; } @@ -221,7 +221,7 @@ res_initid(void) WRAP(clock_gettime)(CLOCK_MONOTONIC, &ts); ru_reseed = ts.tv_sec + RU_OUT; - ru_msb = ru_msb == 0x8000 ? 0 : 0x8000; + ru_msb = ru_msb == 0x8000 ? 0 : 0x8000; } u_int diff --git a/lib/libc/net/rresvport.c b/lib/libc/net/rresvport.c index 72c27c3a3..165442af9 100644 --- a/lib/libc/net/rresvport.c +++ b/lib/libc/net/rresvport.c @@ -80,7 +80,7 @@ rresvport_af(int *alport, int af) return (-1); } sa->sa_family = af; - + s = socket(af, SOCK_STREAM, 0); if (s == -1) return (-1); diff --git a/lib/libc/net/rthdr.c b/lib/libc/net/rthdr.c index 5ffb13fc8..9fb877b9d 100644 --- a/lib/libc/net/rthdr.c +++ b/lib/libc/net/rthdr.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -134,7 +134,7 @@ inet6_rth_reverse(const void *in, void *out) *addr1 = *addr2; *addr2 = addr_tmp; } - + break; default: return (-1); /* type not supported */ @@ -178,7 +178,7 @@ inet6_rth_getaddr(const void *bp, int idx) switch (rh->ip6r_type) { case IPV6_RTHDR_TYPE_0: rh0 = (struct ip6_rthdr0 *)bp; - + /* * Validation for a type-0 routing header. * Is this too strict? diff --git a/lib/libc/net/vars6.c b/lib/libc/net/vars6.c index a12932a26..18103fd1b 100644 --- a/lib/libc/net/vars6.c +++ b/lib/libc/net/vars6.c @@ -3,7 +3,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,7 +15,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/lib/libc/nls/Makefile.inc b/lib/libc/nls/Makefile.inc index 7d77149a6..9f3e4111d 100644 --- a/lib/libc/nls/Makefile.inc +++ b/lib/libc/nls/Makefile.inc @@ -2,5 +2,5 @@ .PATH: ${LIBCSRCDIR}/nls -SRCS+= catclose.c catgets.c catopen.c +SRCS+= catclose.c catgets.c catopen.c MAN+= catclose.3 catgets.3 catopen.3 diff --git a/lib/libc/nls/catclose.c b/lib/libc/nls/catclose.c index c68b68493..335e926c7 100644 --- a/lib/libc/nls/catclose.c +++ b/lib/libc/nls/catclose.c @@ -43,7 +43,7 @@ catclose(nl_catd catd) errno = EBADF; return -1; } - + if (catd) { munmap(catd->__data, catd->__size); free (catd); diff --git a/lib/libc/nls/catgets.c b/lib/libc/nls/catgets.c index b0ecc598f..d41fdfa2e 100644 --- a/lib/libc/nls/catgets.c +++ b/lib/libc/nls/catgets.c @@ -48,7 +48,7 @@ catgets(nl_catd catd, int set_id, int msg_id, const char *s) return (char *) s; } - cat_hdr = (struct _nls_cat_hdr *) catd->__data; + cat_hdr = (struct _nls_cat_hdr *) catd->__data; set_hdr = (struct _nls_set_hdr *) ((char *)catd->__data + sizeof(struct _nls_cat_hdr)); @@ -70,7 +70,7 @@ catgets(nl_catd catd, int set_id, int msg_id, const char *s) i = (l + u) / 2; r = msg_id - ntohl(msg_hdr[i].__msgno); if (r == 0) { - return (char *) catd->__data + return (char *) catd->__data + sizeof(struct _nls_cat_hdr) + ntohl(cat_hdr->__msg_txt_offset) + ntohl(msg_hdr[i].__offset); diff --git a/lib/libc/nls/catopen.c b/lib/libc/nls/catopen.c index e03ebaf0a..f29b9021a 100644 --- a/lib/libc/nls/catopen.c +++ b/lib/libc/nls/catopen.c @@ -57,7 +57,7 @@ catopen(const char *name, int oflag) char *s, *t, *sep, *dot; const char *u; nl_catd catd; - + if (name == NULL || *name == '\0') return (nl_catd) -1; diff --git a/lib/libc/quad/muldi3.c b/lib/libc/quad/muldi3.c index 3cce20fff..98bcfe608 100644 --- a/lib/libc/quad/muldi3.c +++ b/lib/libc/quad/muldi3.c @@ -42,7 +42,7 @@ * * u = 2^n u1 * u0 (n = number of bits in `u_int', usu. 32) * - * and + * and * * v = 2^n v1 * v0 * diff --git a/lib/libc/quad/qdivrem.c b/lib/libc/quad/qdivrem.c index b437e8619..b53238a4f 100644 --- a/lib/libc/quad/qdivrem.c +++ b/lib/libc/quad/qdivrem.c @@ -177,7 +177,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) v2 = v[2]; /* for D3 */ do { digit uj0, uj1, uj2; - + /* * D3: Calculate qhat (\^q, in TeX notation). * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and diff --git a/lib/libc/softfloat/softfloat.c b/lib/libc/softfloat/softfloat.c index 88ebe1f5a..8beb23d3e 100644 --- a/lib/libc/softfloat/softfloat.c +++ b/lib/libc/softfloat/softfloat.c @@ -378,7 +378,7 @@ INLINE float64 { return FLOAT64_MANGLE( ( ( (bits64) zSign )<<63 ) + - ( ( (bits64) zExp )<<52 ) + + ( ( (bits64) zExp )<<52 ) + ( ( (bits64) zSig0 )<<32 ) + zSig1 ); diff --git a/lib/libc/softfloat/timesoftfloat.c b/lib/libc/softfloat/timesoftfloat.c index c3a81a7ad..1e054fdf3 100644 --- a/lib/libc/softfloat/timesoftfloat.c +++ b/lib/libc/softfloat/timesoftfloat.c @@ -2585,7 +2585,7 @@ main( int argc, char **argv ) else { for ( functionCode = 1; functionCode < NUM_FUNCTIONS; - ++functionCode + ++functionCode ) { if ( strcmp( argPtr, functions[ functionCode ].name ) == 0 ) { break; diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c index 6fd80d0c4..e6360514f 100644 --- a/lib/libc/stdio/findfp.c +++ b/lib/libc/stdio/findfp.c @@ -48,7 +48,7 @@ int __sdidinit; #define std(flags, file) \ {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \ {(unsigned char *)(__sFext+file), 0}} -/* p r w flags file _bf z cookie close read seek write +/* p r w flags file _bf z cookie close read seek write ext */ /* the usual - (stdin + stdout + stderr) */ @@ -173,6 +173,6 @@ __sinit(void) /* make sure we clean up on exit */ __atexit_register_cleanup(_cleanup); /* conservative */ __sdidinit = 1; -out: +out: _MUTEX_UNLOCK(&sinit_mutex); } diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c index d6df6daab..bf3086786 100644 --- a/lib/libc/stdio/flags.c +++ b/lib/libc/stdio/flags.c @@ -72,7 +72,7 @@ __sflags(const char *mode, int *optr) return (0); } - while (*mode != '\0') + while (*mode != '\0') switch (*mode++) { case 'b': break; diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 65065e54d..c5a38b7b8 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -41,8 +41,8 @@ #include #include "local.h" -/* - * Re-direct an existing, open (probably) file to some other file. +/* + * Re-direct an existing, open (probably) file to some other file. * ANSI is written such that the original file gets closed if at * all possible, no matter what. */ diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h index 603259e5a..a865ca093 100644 --- a/lib/libc/stdio/local.h +++ b/lib/libc/stdio/local.h @@ -37,7 +37,7 @@ * in particular, macros and private variables. */ -#include +#include #include "wcio.h" #include "fileext.h" #include "thread_private.h" diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index fe28f0091..3e24cea22 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -44,7 +44,7 @@ __sread(void *cookie, char *buf, int n) { FILE *fp = cookie; int ret; - + ret = read(fp->_file, buf, n); /* if the read succeeded, update the current offset */ if (ret >= 0) @@ -70,7 +70,7 @@ __sseek(void *cookie, fpos_t offset, int whence) { FILE *fp = cookie; off_t ret; - + ret = lseek(fp->_file, offset, whence); if (ret == -1) fp->_flags &= ~__SOFF; diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 759aab522..239dba1ed 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -1496,7 +1496,7 @@ __grow_type_table(unsigned char **typetable, int *tablesize) return (0); } - + #ifdef FLOATING_POINT static int exponent(char *p0, int exp, int fmtch) diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index f968ebbe0..aaaab6204 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -159,7 +159,7 @@ __xfputwc(wchar_t wc, FILE *fp) * string representation. ``prec'' specifies the maximum number of bytes * to output. If ``prec'' is greater than or equal to zero, we can't assume * that the multibyte character string ends in a null character. - * + * * Returns NULL on failure. * To find out what happened check errno for ENOMEM, EILSEQ and EINVAL. */ @@ -1494,7 +1494,7 @@ __grow_type_table(unsigned char **typetable, int *tablesize) return (0); } - + #ifdef FLOATING_POINT static int exponent(wchar_t *p0, int exp, int fmtch) diff --git a/lib/libc/stdlib/getsubopt.c b/lib/libc/stdlib/getsubopt.c index 735c85ba8..857ed5526 100644 --- a/lib/libc/stdlib/getsubopt.c +++ b/lib/libc/stdlib/getsubopt.c @@ -74,7 +74,7 @@ getsubopt(char **optionp, char * const *tokens, char **valuep) *p = '\0'; for (*valuep = ++p; *p && *p != ',' && *p != ' ' && *p != '\t'; ++p); - if (*p) + if (*p) *p++ = '\0'; } else *p++ = '\0'; diff --git a/lib/libc/stdlib/hcreate.c b/lib/libc/stdlib/hcreate.c index b31108a90..b6e033135 100644 --- a/lib/libc/stdlib/hcreate.c +++ b/lib/libc/stdlib/hcreate.c @@ -4,7 +4,7 @@ /* * Copyright (c) 2001 Christopher G. Demetriou * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -20,7 +20,7 @@ * information about NetBSD. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -31,7 +31,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * <> */ @@ -112,7 +112,7 @@ hcreate(size_t nel) _DIAGASSERT(p2 <= MAX_BUCKETS_LG2); nel = 1 << p2; } - + /* Allocate the table. */ htablesize = nel; htable = calloc(htablesize, sizeof htable[0]); diff --git a/lib/libc/stdlib/insque.c b/lib/libc/stdlib/insque.c index 590ff837b..2142f7271 100644 --- a/lib/libc/stdlib/insque.c +++ b/lib/libc/stdlib/insque.c @@ -3,7 +3,7 @@ /* * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,7 +14,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/lib/libc/stdlib/l64a.c b/lib/libc/stdlib/l64a.c index 4f33df37b..decc37634 100644 --- a/lib/libc/stdlib/l64a.c +++ b/lib/libc/stdlib/l64a.c @@ -23,7 +23,7 @@ l64a(long value) for (i = 0; value != 0 && i < 6; i++) { digit = value & 0x3f; - if (digit < 2) + if (digit < 2) *s = digit + '.'; else if (digit < 12) *s = digit + '0' - 2; diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c index d60317ce0..16db70c7d 100644 --- a/lib/libc/stdlib/merge.c +++ b/lib/libc/stdlib/merge.c @@ -73,7 +73,7 @@ static void insertionsort(u_char *, size_t, size_t, int (*)()); do \ *dst++ = *src++; \ while (i -= 1) - + /* * Find the next possible pointer head. (Trickery for forcing an array * to do double duty as a linked list when objects do not align with word @@ -157,7 +157,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1) } else if ((*cmp)(q, p) <= sense) { t = p; if (i == size) - big = 0; + big = 0; goto FASTCASE; } else b = p; diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c index 49d03b52d..b21aeee73 100644 --- a/lib/libc/stdlib/radixsort.c +++ b/lib/libc/stdlib/radixsort.c @@ -4,7 +4,7 @@ * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Peter McIlroy and by Dan Bernstein at New York University, + * Peter McIlroy and by Dan Bernstein at New York University, * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,13 +33,13 @@ /* * Radixsort routines. - * + * * Program r_sort_a() is unstable but uses O(logN) extra memory for a stack. * Use radixsort(a, n, trace, endchar) for this case. - * + * * For stable sorting (using N extra pointers) use sradixsort(), which calls * r_sort_b(). - * + * * For a description of this code, see D. McIlroy, P. McIlroy, K. Bostic, * "Engineering Radix Sort". */ @@ -273,7 +273,7 @@ r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr, *--top[tr[(*ak)[i]]] = *ak; } } - + static __inline void simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch) /* insertion sort */ diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index 62a0c24bd..b296c4d96 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -58,7 +58,7 @@ * state information, which will allow a degree seven polynomial. (Note: * the zeroeth word of state information also has some other information * stored in it -- see setstate() for details). - * + * * The random number generation technique is a linear feedback shift register * approach, employing trinomials (since there are fewer terms to sum up that * way). In this approach, the least significant bit of all the numbers in @@ -132,11 +132,11 @@ static int seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; static int32_t randtbl[DEG_3 + 1] = { TYPE_3, - 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05, - 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454, - 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471, - 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1, - 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41, + 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05, + 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454, + 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471, + 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1, + 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41, 0xf3bec5da, }; @@ -253,12 +253,12 @@ srandom_deterministic(unsigned int x) * the break values for the different R.N.G.'s, we choose the best (largest) * one we can and set things up for it. srandom() is then called to * initialize the state information. - * + * * Note that on return from srandom(), we set state[-1] to be the type * multiplexed with the current value of the rear pointer; this is so * successive calls to initstate() won't lose this information and will be * able to restart with setstate(). - * + * * Note: the first thing we do is save the current state, if any, just like * setstate() so that it doesn't matter when initstate is called. * diff --git a/lib/libc/stdlib/remque.c b/lib/libc/stdlib/remque.c index 71b74b2dc..3ac83d128 100644 --- a/lib/libc/stdlib/remque.c +++ b/lib/libc/stdlib/remque.c @@ -3,7 +3,7 @@ /* * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,7 +14,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/lib/libc/string/strsep.c b/lib/libc/string/strsep.c index 97c3cbf1f..4eeac59ca 100644 --- a/lib/libc/string/strsep.c +++ b/lib/libc/string/strsep.c @@ -33,7 +33,7 @@ /* * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. + * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. diff --git a/lib/libc/string/wcstok.c b/lib/libc/string/wcstok.c index bc1ac3e8c..ceeea5f54 100644 --- a/lib/libc/string/wcstok.c +++ b/lib/libc/string/wcstok.c @@ -45,7 +45,7 @@ #include wchar_t * -wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim, +wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim, wchar_t ** __restrict last) { const wchar_t *spanp; diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index f45b41ada..f941b558d 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -112,7 +112,7 @@ ASM_NOERR=__get_tcb.o __set_tcb.o __threxit.o __thrsleep.o __thrwakeup.o \ getthrname.o getuid.o \ issetugid.o \ sched_yield.o setthrname.o sync.o \ - umask.o + umask.o PASM_NOERR= ${ASM_NOERR:.o=.po} SASM_NOERR= ${ASM_NOERR:.o=.so} DASM_NOERR= ${ASM_NOERR:.o=.do} diff --git a/lib/libc/thread/rthread_file.c b/lib/libc/thread/rthread_file.c index 0ea1c16dc..a30035e44 100644 --- a/lib/libc/thread/rthread_file.c +++ b/lib/libc/thread/rthread_file.c @@ -265,7 +265,7 @@ _thread_ftrylockfile(FILE * fp) return (ret); } -void +void _thread_funlockfile(FILE * fp) { int idx = file_idx(fp); diff --git a/lib/libc/time/wcsftime.c b/lib/libc/time/wcsftime.c index 6870871bc..0b2ae4e93 100644 --- a/lib/libc/time/wcsftime.c +++ b/lib/libc/time/wcsftime.c @@ -59,7 +59,7 @@ static const struct lc_time_T C_time_locale = { L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" }, { L"January", L"February", L"March", L"April", L"May", L"June", - L"July", L"August", L"September", L"October", L"November", + L"July", L"August", L"September", L"October", L"November", L"December" }, { L"Sun", L"Mon", L"Tue", L"Wed", @@ -116,7 +116,7 @@ extern char * tzname[]; #define IN_ALL 3 size_t -wcsftime(wchar_t *__restrict s, size_t maxsize, +wcsftime(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict t) { wchar_t *p; @@ -135,7 +135,7 @@ wcsftime(wchar_t *__restrict s, size_t maxsize, } static wchar_t * -_fmt(const wchar_t *format, const struct tm *t, wchar_t *pt, +_fmt(const wchar_t *format, const struct tm *t, wchar_t *pt, const wchar_t *ptlim, int *warnp) { for ( ; *format; ++format) { @@ -292,7 +292,7 @@ label: tm = *t; mkt = mktime(&tm); - (void) swprintf(buf, + (void) swprintf(buf, sizeof buf/sizeof buf[0], L"%ld", (long) mkt); pt = _add(buf, pt, ptlim); @@ -361,7 +361,7 @@ label: DAYSPERLYEAR : DAYSPERNYEAR; /* - ** What yday (-3 ... 3) does the ISO year + ** What yday (-3 ... 3) does the ISO year ** begin on? */ bot = ((yday + 11 - wday) % DAYSPERWEEK) - 3; @@ -394,7 +394,7 @@ label: else if (*format == 'g') { *warnp = IN_ALL; pt = _yconv(year, base, 0, 1, pt, ptlim); - } else + } else pt = _yconv(year, base, 1, 1, pt, ptlim); } continue; @@ -442,7 +442,7 @@ label: pt = _sadd(t->tm_zone, pt, ptlim); else if (t->tm_isdst >= 0) - pt = _sadd(tzname[t->tm_isdst != 0], + pt = _sadd(tzname[t->tm_isdst != 0], pt, ptlim); /* ** C99 says that %Z must be replaced by the @@ -461,7 +461,7 @@ label: if (diff < 0) { sign = L"-"; diff = -diff; - } else + } else sign = L"+"; pt = _add(sign, pt, ptlim); diff /= SECSPERMIN; @@ -521,7 +521,7 @@ _sadd(const char *str, wchar_t *pt, const wchar_t *ptlim) */ static wchar_t * -_yconv(int a, int b, int convert_top, int convert_yy, wchar_t *pt, +_yconv(int a, int b, int convert_top, int convert_yy, wchar_t *pt, const wchar_t *ptlim) { int lead; diff --git a/lib/libcbor/Makefile b/lib/libcbor/Makefile index 561cba6e4..d51757a4a 100644 --- a/lib/libcbor/Makefile +++ b/lib/libcbor/Makefile @@ -17,7 +17,7 @@ CDIAGFLAGS+= -Wno-missing-field-initializers # cbor/ SRCS+= arrays.c bytestrings.c callbacks.c common.c encoding.c floats_ctrls.c -SRCS+= ints.c maps.c serialization.c streaming.c tags.c strings.c +SRCS+= ints.c maps.c serialization.c streaming.c tags.c strings.c # cbor/internal SRCS+= builder_callbacks.c encoders.c loaders.c memory_utils.c diff --git a/lib/libcbor/src/cbor/cbor_export.h b/lib/libcbor/src/cbor/cbor_export.h index de5497464..0758ee6fd 100644 --- a/lib/libcbor/src/cbor/cbor_export.h +++ b/lib/libcbor/src/cbor/cbor_export.h @@ -9,15 +9,15 @@ # ifndef CBOR_EXPORT # ifdef cbor_EXPORTS /* We are building this library */ -# define CBOR_EXPORT +# define CBOR_EXPORT # else /* We are using this library */ -# define CBOR_EXPORT +# define CBOR_EXPORT # endif # endif # ifndef CBOR_NO_EXPORT -# define CBOR_NO_EXPORT +# define CBOR_NO_EXPORT # endif #endif diff --git a/lib/libcbor/src/cbor/configuration.h b/lib/libcbor/src/cbor/configuration.h index d4ea06ee1..0a0d3f18c 100644 --- a/lib/libcbor/src/cbor/configuration.h +++ b/lib/libcbor/src/cbor/configuration.h @@ -10,6 +10,6 @@ #define CBOR_PRETTY_PRINTER 1 #define CBOR_RESTRICT_SPECIFIER restrict -#define CBOR_INLINE_SPECIFIER +#define CBOR_INLINE_SPECIFIER #endif //LIBCBOR_CONFIGURATION_H diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 4086d75e2..710741359 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -821,7 +821,7 @@ extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_printw) /* implemented */ GCC_PRINTFLIKE(2,0); extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *, va_list) /* implemented */ - GCC_PRINTFLIKE(2,0); + GCC_PRINTFLIKE(2,0); extern NCURSES_EXPORT(int) vwscanw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_scanw) /* implemented */ GCC_SCANFLIKE(2,0); extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, const char *, va_list) /* implemented */ diff --git a/lib/libevent/min_heap.h b/lib/libevent/min_heap.h index 2b8d245ff..ad0466a5a 100644 --- a/lib/libevent/min_heap.h +++ b/lib/libevent/min_heap.h @@ -50,13 +50,13 @@ static inline int min_heap_erase(min_heap_t * s, struct event * e); static inline void min_heap_shift_up_(min_heap_t * s, size_t hole_index, struct event * e); static inline void min_heap_shift_down_(min_heap_t * s, size_t hole_index, struct event * e); -int +int min_heap_elem_greater(struct event * a, struct event * b) { return timercmp(&a->ev_timeout, &b->ev_timeout, >); } -void +void min_heap_ctor(min_heap_t * s) { s->p = 0; @@ -67,17 +67,17 @@ void min_heap_dtor(min_heap_t * s) { if (s->p) free(s->p); } -void +void min_heap_elem_init(struct event * e) { e->min_heap_idx = SIZE_MAX; } -int +int min_heap_empty(min_heap_t * s) { return 0 == s->n; } -size_t +size_t min_heap_size(min_heap_t * s) { return s->n; @@ -88,7 +88,7 @@ min_heap_top(min_heap_t * s) return s->n ? *s->p : 0; } -int +int min_heap_push(min_heap_t * s, struct event * e) { if (min_heap_reserve(s, s->n + 1)) @@ -109,7 +109,7 @@ min_heap_pop(min_heap_t * s) return 0; } -int +int min_heap_erase(min_heap_t * s, struct event * e) { if (e->min_heap_idx != SIZE_MAX) { @@ -132,7 +132,7 @@ min_heap_erase(min_heap_t * s, struct event * e) return -1; } -int +int min_heap_reserve(min_heap_t * s, size_t n) { if (s->a < n) { @@ -148,7 +148,7 @@ min_heap_reserve(min_heap_t * s, size_t n) return 0; } -void +void min_heap_shift_up_(min_heap_t * s, size_t hole_index, struct event * e) { size_t parent = (hole_index - 1) / 2; @@ -162,7 +162,7 @@ min_heap_shift_up_(min_heap_t * s, size_t hole_index, struct event * e) s->p[hole_index] = e; } -void +void min_heap_shift_down_(min_heap_t * s, size_t hole_index, struct event * e) { size_t min_child = 2 * (hole_index + 1); diff --git a/lib/libexpat/tests/xmltest.sh b/lib/libexpat/tests/xmltest.sh index dc409d01e..09b646a04 100755 --- a/lib/libexpat/tests/xmltest.sh +++ b/lib/libexpat/tests/xmltest.sh @@ -75,7 +75,7 @@ RunXmlwfNotWF() { return 1 else return 0 - fi + fi } # RunXmlwfWF file reldir @@ -84,21 +84,21 @@ RunXmlwfWF() { file="$1" reldir="$2" $XMLWF -p -N -d "$OUTPUT$reldir" "$file" > outfile || return $? - read outdata < outfile - if test "$outdata" = "" ; then - if [ -f "out/$file" ] ; then - $DIFF "$OUTPUT$reldir$file" "out/$file" > outfile - if [ -s outfile ] ; then + read outdata < outfile + if test "$outdata" = "" ; then + if [ -f "out/$file" ] ; then + $DIFF "$OUTPUT$reldir$file" "out/$file" > outfile + if [ -s outfile ] ; then cp outfile "$OUTPUT$reldir$file.diff" echo "Output differs: $reldir$file" return 1 - fi - fi + fi + fi return 0 - else + else echo "In $reldir: $outdata" return 1 - fi + fi } SUCCESS=0 diff --git a/lib/libfido2/man/fido_dev_largeblob_get.3 b/lib/libfido2/man/fido_dev_largeblob_get.3 index aa3edf2c9..c59d9c35b 100644 --- a/lib/libfido2/man/fido_dev_largeblob_get.3 +++ b/lib/libfido2/man/fido_dev_largeblob_get.3 @@ -69,7 +69,7 @@ function retrieves the authenticator's CBOR array and, on success, returns the first blob .Pq iterating from array index zero that can be -decrypted by +decrypted by .Fa key_ptr , where .Fa key_ptr diff --git a/lib/libfuse/fuse.h b/lib/libfuse/fuse.h index ee0edaf75..1f989b889 100644 --- a/lib/libfuse/fuse.h +++ b/lib/libfuse/fuse.h @@ -91,7 +91,7 @@ typedef int (*fuse_fill_dir_t)(void *, const char *, const struct stat *, typedef struct fuse_dirhandle *fuse_dirh_t; typedef int (*fuse_dirfil_t)(fuse_dirh_t, const char *, int, ino_t); -/* +/* * Fuse operations work in the same way as their UNIX file system * counterparts. A major exception is that these routines return * a negated errno value (-errno) on failure. diff --git a/lib/libkeynote/HOWTO.add.crypto b/lib/libkeynote/HOWTO.add.crypto index 3b67985e0..e3329bfcf 100644 --- a/lib/libkeynote/HOWTO.add.crypto +++ b/lib/libkeynote/HOWTO.add.crypto @@ -56,7 +56,7 @@ For an ASCII-encoding algorithm: - Add an ENCODING_* definition in keynote.h - Add additional key prefix string definitions in signature.h - In signature.c: - - In keynote_get_sig_algorithm(), add code for detecting signatures + - In keynote_get_sig_algorithm(), add code for detecting signatures with this encoding. - Likewise for keys in keynote_get_key_algorithm() - In kn_decode_key(), add code in the switch statement for decoding diff --git a/lib/libkeynote/LICENSE b/lib/libkeynote/LICENSE index 72b022dfd..26a79ae26 100644 --- a/lib/libkeynote/LICENSE +++ b/lib/libkeynote/LICENSE @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/Makefile b/lib/libkeynote/Makefile index a347c1898..6c0a5fe49 100644 --- a/lib/libkeynote/Makefile +++ b/lib/libkeynote/Makefile @@ -2,7 +2,7 @@ LIB= keynote MAN= keynote.3 keynote.4 keynote.5 -NOPIC= +NOPIC= CFLAGS+= -Wall -I. -I${.CURDIR} LEXFLAGS = -Cr -Pkn -s -i YACCFLAGS = -d -p kn -b k diff --git a/lib/libkeynote/assertion.h b/lib/libkeynote/assertion.h index 9ec28fc29..950571ce6 100644 --- a/lib/libkeynote/assertion.h +++ b/lib/libkeynote/assertion.h @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -29,7 +29,7 @@ #define HASHTABLESIZE 37 #define SESSIONTABLESIZE 37 -struct keynote_session +struct keynote_session { int ks_id; int ks_assertioncounter; @@ -53,14 +53,14 @@ struct keylist struct keylist *key_next; }; -struct assertion +struct assertion { void *as_authorizer; char *as_buf; char *as_signature; char *as_authorizer_string_s; char *as_authorizer_string_e; - char *as_keypred_s; + char *as_keypred_s; char *as_keypred_e; char *as_conditions_s; char *as_conditions_e; diff --git a/lib/libkeynote/auxil.c b/lib/libkeynote/auxil.c index 64071c249..9e335c9d9 100644 --- a/lib/libkeynote/auxil.c +++ b/lib/libkeynote/auxil.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -127,7 +127,7 @@ keynote_in_action_authorizers(void *key, int algorithm) /* * Add a key to the keylist. Return RESULT_TRUE on success, -1 (and set - * keynote_errno) otherwise. We are not supposed to make a copy of the + * keynote_errno) otherwise. We are not supposed to make a copy of the * argument. */ int @@ -135,13 +135,13 @@ keynote_keylist_add(struct keylist **keylist, char *key) { struct keynote_deckey dc; struct keylist *kl; - + if (keylist == NULL) { keynote_errno = ERROR_MEMORY; return -1; } - + kl = calloc(1, sizeof(struct keylist)); if (kl == NULL) { @@ -211,7 +211,7 @@ kn_remove_authorizer(int sessid, char *key) keynote_keylist_free(kl2); return 0; } - + keynote_errno = ERROR_NOTFOUND; return -1; } @@ -359,7 +359,7 @@ keynote_add_htable(struct assertion *as, int which) } /* - * Parse and store an assertion in the internal hash table. + * Parse and store an assertion in the internal hash table. * Return the result of the evaluation, if doing early evaluation. * If an error was encountered, set keynote_errno. */ @@ -398,7 +398,7 @@ kn_add_assertion(int sessid, char *asrt, int len, int assertion_flags) keynote_errno = ERROR_SYNTAX; return -1; } - + if (keynote_add_htable(as, 0) != RESULT_TRUE) { keynote_free_assertion(as); @@ -478,7 +478,7 @@ keynote_sremove_assertion(int sessid, int assertid) return keynote_remove_assertion(sessid, assertid, 0); } -/* +/* * Free an assertion structure. */ void @@ -503,7 +503,7 @@ keynote_free_assertion(struct assertion *as) free(as); } -unsigned int +unsigned int keynote_stringhash(char *name, unsigned int size) { unsigned int hash_val = 0; @@ -512,7 +512,7 @@ keynote_stringhash(char *name, unsigned int size) if ((size == 0) || (size == 1)) return 0; - for (; *name; name++) + for (; *name; name++) { hash_val = (hash_val << 2) + *name; if ((i = hash_val & 0x3fff) != 0) diff --git a/lib/libkeynote/base64.c b/lib/libkeynote/base64.c index 6618330d3..5f8ce7bef 100644 --- a/lib/libkeynote/base64.c +++ b/lib/libkeynote/base64.c @@ -1,5 +1,4 @@ /* $OpenBSD: base64.c,v 1.12 2023/04/13 18:20:21 tb Exp $ */ -/* $OpenBSD: base64.c,v 1.12 2023/04/13 18:20:21 tb Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) * @@ -7,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/environment.c b/lib/libkeynote/environment.c index 8307ee432..dcca9f278 100644 --- a/lib/libkeynote/environment.c +++ b/lib/libkeynote/environment.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -186,7 +186,7 @@ keynote_env_lookup(char *name, struct environment **table, { struct environment *en; - for (en = table[keynote_stringhash(name, hashsize)]; + for (en = table[keynote_stringhash(name, hashsize)]; en != NULL; en = en->env_next) if (((en->env_flags & ENVIRONMENT_FLAG_REGEX) && @@ -213,9 +213,9 @@ keynote_env_delete(char *name, struct environment **table, { struct environment *en, *en2; unsigned int h; - + h = keynote_stringhash(name, hashsize); - + if (table[h] != NULL) { if (!strcmp(table[h]->env_name, name)) @@ -226,7 +226,7 @@ keynote_env_delete(char *name, struct environment **table, return RESULT_TRUE; } else - for (en = table[h]; + for (en = table[h]; en->env_next != NULL; en = en->env_next) if (!strcmp(en->env_next->env_name, name)) @@ -241,7 +241,7 @@ keynote_env_delete(char *name, struct environment **table, return RESULT_FALSE; } -/* +/* * Add a new variable in hash table. Return RESULT_TRUE on success, * ERROR_MEMORY on failure. If hashsize is 1, second argument is * actually a pointer to a list. The arguments are duplicated. @@ -252,7 +252,7 @@ keynote_env_add(char *name, char *value, struct environment **table, { struct environment *en; unsigned int h, i; - + en = calloc(1, sizeof(struct environment)); if (en == NULL) { keynote_errno = ERROR_MEMORY; @@ -301,8 +301,8 @@ keynote_env_add(char *name, char *value, struct environment **table, } } - /* - * This means that new assignments of existing variable will override + /* + * This means that new assignments of existing variable will override * the old ones. */ h = keynote_stringhash(name, hashsize); @@ -321,7 +321,7 @@ keynote_env_cleanup(struct environment **table, unsigned int hashsize) if ((hashsize == 0) || (table == NULL)) return; - + while (hashsize > 0) { while (table[hashsize - 1] != NULL) { @@ -367,7 +367,7 @@ int keynote_retindex(char *s) { int i; - + for (i = 0; i < keynote_current_session->ks_values_num; i++) if (!strcmp(s, keynote_current_session->ks_values[i])) return i; @@ -383,7 +383,7 @@ keynote_find_session(int sessid) { unsigned int h = sessid % SESSIONTABLESIZE; struct keynote_session *ks; - + for (ks = keynote_sessions[h]; ks != NULL; ks = ks->ks_next) @@ -506,7 +506,7 @@ kn_close(int sessid) keynote_sessions[ks->ks_id % SESSIONTABLESIZE] = ks->ks_next; if (ks->ks_next != NULL) ks->ks_next->ks_prev = NULL; - + } else { @@ -514,12 +514,12 @@ kn_close(int sessid) if (ks->ks_next != NULL) ks->ks_next->ks_prev = ks->ks_prev; } - + free(ks); keynote_current_session = NULL; return 0; } - + /* * Add an action attribute. */ @@ -545,7 +545,7 @@ kn_add_action(int sessid, char *name, char *value, int flags) } if (flags & ENVIRONMENT_FLAG_REGEX) - i = keynote_env_add(name, value, + i = keynote_env_add(name, value, &(keynote_current_session->ks_env_regex), 1, flags); else i = keynote_env_add(name, value, keynote_current_session->ks_env_table, @@ -621,7 +621,7 @@ kn_do_query(int sessid, char **returnvalues, int numvalues) return -1; } - /* + /* * We may use already set returnvalues, or use new ones, * but we must have some before we can evaluate. */ diff --git a/lib/libkeynote/header.h b/lib/libkeynote/header.h index 3d72629e4..eb1124517 100644 --- a/lib/libkeynote/header.h +++ b/lib/libkeynote/header.h @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/keynote-keygen.c b/lib/libkeynote/keynote-keygen.c index 9b1d84030..fa12e8fcc 100644 --- a/lib/libkeynote/keynote-keygen.c +++ b/lib/libkeynote/keynote-keygen.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/keynote-main.c b/lib/libkeynote/keynote-main.c index 5480a3226..9c204a837 100644 --- a/lib/libkeynote/keynote-main.c +++ b/lib/libkeynote/keynote-main.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c index 0d208452f..4beba0787 100644 --- a/lib/libkeynote/keynote-sign.c +++ b/lib/libkeynote/keynote-sign.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -72,7 +72,7 @@ keynote_sign(int argc, char *argv[]) exit(1); } } - + if (argc > 5 + flg) { prlen = atoi(argv[5 + flg]); diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c index 10b64a3c8..be9abc589 100644 --- a/lib/libkeynote/keynote-sigver.c +++ b/lib/libkeynote/keynote-sigver.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/keynote-ver.l b/lib/libkeynote/keynote-ver.l index 768f88ef8..73a2f9be5 100644 --- a/lib/libkeynote/keynote-ver.l +++ b/lib/libkeynote/keynote-ver.l @@ -7,11 +7,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -220,7 +220,7 @@ read_environment(char *filename) perror(filename); return -1; } - + kvfoo = kv_create_buffer(fp, YY_BUF_SIZE); kv_switch_to_buffer(kvfoo); BEGIN(FIRSTPART); @@ -231,7 +231,7 @@ read_environment(char *filename) { case 0: return 0; - + default: if (keynote_errno == ERROR_MEMORY) fprintf(stderr, diff --git a/lib/libkeynote/keynote-ver.y b/lib/libkeynote/keynote-ver.y index cd6b02f83..7e5d09ae6 100644 --- a/lib/libkeynote/keynote-ver.y +++ b/lib/libkeynote/keynote-ver.y @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -60,7 +60,7 @@ expr: VSTRING EQ STRING { int i = kn_add_action(sessid, $1, $3, 0); return i; free($1); free($3); - } expr + } expr %% void kverror(char *s) diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c index 288d738df..561a419eb 100644 --- a/lib/libkeynote/keynote-verify.c +++ b/lib/libkeynote/keynote-verify.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -90,10 +90,10 @@ keynote_verify(int argc, char *argv[]) fprintf(stderr, "kn_init() failed (errno %d).\n", keynote_errno); exit(keynote_errno); } - + while ((ch = getopt(argc, argv, "hqistl:e:k:r:")) != -1) { - switch (ch) + switch (ch) { case 'e': if (read_environment(optarg) == -1) @@ -184,7 +184,7 @@ keynote_verify(int argc, char *argv[]) foov = calloc(numretv, sizeof(char **)); if (foov == NULL) { - /* + /* * If this were a real program, we 'd be freeing * retv here. Since we're exiting, we can be a * little sloppy. diff --git a/lib/libkeynote/keynote.h b/lib/libkeynote/keynote.h index 66b002b32..0ac5f1c0c 100644 --- a/lib/libkeynote/keynote.h +++ b/lib/libkeynote/keynote.h @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -81,10 +81,10 @@ struct keynote_keylist #define ENVIRONMENT_FLAG_FUNC 0x0001 /* This is a callback function */ #define ENVIRONMENT_FLAG_REGEX 0x0002 /* Regular expression for name */ -#define ASSERT_FLAG_LOCAL 0x0001 /* +#define ASSERT_FLAG_LOCAL 0x0001 /* * Trusted assertion -- means * signature is not verified, and - * authorizer field can + * authorizer field can * include symbolic names. */ #define ASSERT_FLAG_SIGGEN 0x0002 /* diff --git a/lib/libkeynote/keynote.l b/lib/libkeynote/keynote.l index f60966dd3..b0d257984 100644 --- a/lib/libkeynote/keynote.l +++ b/lib/libkeynote/keynote.l @@ -7,11 +7,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -64,11 +64,11 @@ comment "#"[^\n]* * in yacc. */ extern int first_tok; - + if (first_tok) { int holdtok = first_tok; - + first_tok = 0; return holdtok; } @@ -170,7 +170,7 @@ comment "#"[^\n]* knlval.string = NULL; return STRING; } - + knlval.string = calloc(strlen(kntext) - 1, sizeof(char)); if (knlval.string == NULL) @@ -179,7 +179,7 @@ comment "#"[^\n]* return -1; } - mystrncpy(knlval.string, kntext + 1, + mystrncpy(knlval.string, kntext + 1, strlen(kntext) - 2); if (keynote_lex_add(knlval.string, @@ -188,7 +188,7 @@ comment "#"[^\n]* return STRING; } [ \t\n] -. { keynote_errno = ERROR_SYNTAX; +. { keynote_errno = ERROR_SYNTAX; return -1; REJECT; /* Avoid -Wall warning. Not reached */ } @@ -201,7 +201,7 @@ static void keynote_lex_zap(void) { int i; - + if (keynote_lex_counter == 0) return; @@ -220,7 +220,7 @@ keynote_lex_zap(void) keynote_lex_list[i].lex_type = 0; } } - + /* * Initialize. */ @@ -445,7 +445,7 @@ mystrncpy(char *s1, char *s2, int len) } } -/* +/* * Evaluate an assertion, with as->as_result holding the result. * Return RESULT_TRUE if all ok. Also return the result. */ @@ -473,7 +473,7 @@ keynote_evaluate_assertion(struct assertion *as) first_tok = ACTSTR; as->as_result = 0; keynote_returnvalue = 0; - + switch (knparse()) { case 1: /* Fall through */ @@ -481,7 +481,7 @@ keynote_evaluate_assertion(struct assertion *as) case -1: as->as_result = 0; break; - + case 0: as->as_result = keynote_returnvalue; break; @@ -502,8 +502,8 @@ keynote_evaluate_assertion(struct assertion *as) return RESULT_TRUE; } -/* - * Parse/evaluate a key predicate field. +/* + * Parse/evaluate a key predicate field. * Store keys in key predicate as keylist in as->as_keylist, if second * argument is true. */ @@ -535,7 +535,7 @@ keynote_parse_keypred(struct assertion *as, int record) keynote_errno = ERROR_SYNTAX; kn_delete_buffer(keypred_state); - keynote_lex_zap(); + keynote_lex_zap(); keynote_cleanup_kth(); keynote_init_list = NULL; @@ -637,7 +637,7 @@ keynote_evaluate_authorizer(struct assertion *as, int flag) as->as_signature = keynote_keypred_keylist->key_key; } - + keynote_keypred_keylist->key_key = NULL; keynote_keylist_free(keynote_keypred_keylist); keynote_keypred_keylist = NULL; diff --git a/lib/libkeynote/keynote.y b/lib/libkeynote/keynote.y index c4fc0724c..2a4a01cbc 100644 --- a/lib/libkeynote/keynote.y +++ b/lib/libkeynote/keynote.y @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -28,8 +28,8 @@ %type NUM KOF numex afterhint notemptyprog %type notemptykeypredicate prog key keyexp keylist %type FLOAT floatex -%type STRING VARIABLE str strnotconcat -%token TRUE FALSE NUM FLOAT STRING VARIABLE +%type STRING VARIABLE str strnotconcat +%token TRUE FALSE NUM FLOAT STRING VARIABLE %token OPENPAREN CLOSEPAREN EQQ COMMA ACTSTR LOCINI KOF KEYPRE KNVERSION %token DOTT SIGNERKEY HINT OPENBLOCK CLOSEBLOCK SIGNATUREENTRY PRIVATEKEY %token SEMICOLON TRUE FALSE @@ -86,9 +86,9 @@ grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } STRING { keynote_lex_remove($3); keynote_privkey = $3; } - + keypredicate: /* Nothing */ { keynote_returnvalue = 0; - return 0; + return 0; } | notemptykeypredicate { keynote_returnvalue = $1; return 0; @@ -99,7 +99,7 @@ notemptykeypredicate: key { $$ = $1; } keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord) keynote_donteval = 1; - } notemptykeypredicate + } notemptykeypredicate { if ($1 > $4) $$ = $4; else @@ -120,7 +120,7 @@ keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord) if (!keynote_justrecord && !keynote_donteval) if (keynote_init_kth() == -1) return -1; - } keylist CLOSEPAREN + } keylist CLOSEPAREN { if (keylistcount < $1) { @@ -135,7 +135,7 @@ keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord) } /* K-th */ keylist: key - { /* Don't do anything if we're just recording */ + { /* Don't do anything if we're just recording */ if (!keynote_justrecord && !keynote_donteval) if (($1 < keynote_current_session->ks_values_num) && ($1 >= 0)) keynote_kth_array[$1]++; @@ -143,7 +143,7 @@ keylist: key keylistcount++; } | key COMMA keylist - { /* Don't do anything if we're just recording */ + { /* Don't do anything if we're just recording */ if (!keynote_justrecord && !keynote_donteval) if (($1 < keynote_current_session->ks_values_num) && ($1 >= 0)) keynote_kth_array[$1]++; @@ -174,13 +174,13 @@ key: str { case -1: free($1); return -1; - + case RESULT_TRUE: free($1); $$ = keynote_current_session->ks_values_num - 1; break; - + default: $$ = resolve_assertion($1); free($1); @@ -192,13 +192,13 @@ key: str { localinit: /* Nothing */ | localconstants -localconstants: VARIABLE EQQ STRING +localconstants: VARIABLE EQQ STRING { int i; keynote_lex_remove($1); keynote_lex_remove($3); - + /* * Variable names starting with underscores are illegal here. */ @@ -209,7 +209,7 @@ localconstants: VARIABLE EQQ STRING keynote_errno = ERROR_SYNTAX; return -1; } - + /* If the identifier already exists, report error. */ if (keynote_env_lookup($1, &keynote_init_list, 1) != NULL) { @@ -243,7 +243,7 @@ localconstants: VARIABLE EQQ STRING keynote_errno = ERROR_SYNTAX; return -1; } - + /* If the identifier already exists, report error. */ if (keynote_env_lookup($1, &keynote_init_list, 1) != NULL) { @@ -261,15 +261,15 @@ localconstants: VARIABLE EQQ STRING return -1; } localconstants -program: prog { +program: prog { keynote_returnvalue = $1; return 0; } prog: /* Nada */ { $$ = 0; } | notemptyprog { - /* - * Cleanup envlist of additions such as + /* + * Cleanup envlist of additions such as * regexp results */ keynote_env_cleanup(&keynote_temp_list, 1); @@ -279,7 +279,7 @@ prog: /* Nada */ { $$ = 0; } $$ = $1; else $$ = $4; - } + } notemptyprog: expr HINT afterhint { @@ -288,7 +288,7 @@ notemptyprog: expr HINT afterhint else $$ = 0; } - | expr + | expr { if (checkexception($1)) $$ = keynote_current_session->ks_values_num - 1; @@ -319,7 +319,7 @@ expr: OPENPAREN expr CLOSEPAREN { $$ = $2; } keynote_donteval = 0; } | expr OR { if ($1) - keynote_donteval = 1; + keynote_donteval = 1; } expr { $$ = ($1 || $4); keynote_donteval = 0; } @@ -405,7 +405,7 @@ floatex: floatex PLUS floatex { $$ = ($1 + $3); } else { keynote_lex_remove($2); - + if (!isfloatstring($2)) $$ = 0.0; else @@ -486,7 +486,7 @@ stringexp: str EQ str { free($3); } } - | str REGEXP str + | str REGEXP str { regmatch_t pmatch[32]; char grp[10], *gr; @@ -681,8 +681,8 @@ resolve_assertion(char *s) return 0; } -/* - * Environment variable lookup. +/* + * Environment variable lookup. */ static char * my_lookup(char *s) @@ -791,15 +791,15 @@ checkexception(int i) } -/* - * Integer exponentiation -- copied from Schneier's AC2, page 244. +/* + * Integer exponentiation -- copied from Schneier's AC2, page 244. */ static int intpow(int x, int y) { int s = 1; - - /* + + /* * x^y with y < 0 is equivalent to 1/(x^y), which for * integer arithmetic is 0. */ @@ -810,7 +810,7 @@ intpow(int x, int y) { if (y & 1) s *= x; - + y >>= 1; x *= x; } @@ -818,14 +818,14 @@ intpow(int x, int y) return s; } -/* - * Check whether the string is a floating point number. +/* + * Check whether the string is a floating point number. */ static int isfloatstring(char *s) { int i, point = 0; - + for (i = strlen(s) - 1; i >= 0; i--) if (!isdigit((unsigned char)s[i])) { @@ -850,10 +850,10 @@ static int keynote_init_kth(void) { int i = keynote_current_session->ks_values_num; - + if (i == -1) return -1; - + keynote_kth_array = calloc(i, sizeof(int)); if (keynote_kth_array == NULL) { @@ -875,7 +875,7 @@ get_kth(int k) for (i = keynote_current_session->ks_values_num - 1; i >= 0; i--) { k -= keynote_kth_array[i]; - + if (k <= 0) return i; } diff --git a/lib/libkeynote/parse_assertion.c b/lib/libkeynote/parse_assertion.c index 59dd7d162..981b70657 100644 --- a/lib/libkeynote/parse_assertion.c +++ b/lib/libkeynote/parse_assertion.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -46,7 +46,7 @@ rec_evaluate_query(struct assertion *as) /* * If we get the minimum result or an error from evaluating this - * assertion, we don't need to recurse. + * assertion, we don't need to recurse. */ keynote_evaluate_assertion(as); if (keynote_errno != 0) @@ -177,7 +177,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield) { struct assertion *as; int i; - + /* Signature generation/verification handling, no need to eval Licensees */ if (ast != NULL) { @@ -192,7 +192,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield) return RESULT_TRUE; } - + for (i = 0; i < HASHTABLESIZE; i++) for (as = keynote_current_session->ks_assertion_table[i]; as != NULL; @@ -203,7 +203,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield) !(as->as_internalflags & ASSERT_IFLAG_WEIRDAUTH) && !(as->as_internalflags & ASSERT_IFLAG_WEIRDSIG)) continue; - + /* Parse the Signature field */ if (((as->as_internalflags & ASSERT_IFLAG_WEIRDSIG) || (as->as_internalflags & ASSERT_IFLAG_NEEDPROC)) && @@ -217,7 +217,7 @@ keynote_fix_fields(struct assertion *ast, int sigfield) else keynote_errno = 0; } - + /* Parse the Licensees field */ if ((as->as_internalflags & ASSERT_IFLAG_WEIRDLICS) || (as->as_internalflags & ASSERT_IFLAG_NEEDPROC)) @@ -315,7 +315,7 @@ keynote_evaluate_query(void) if (prev == (keynote_current_session->ks_values_num - 1)) return prev; } - + return prev; } @@ -358,7 +358,7 @@ whichkeyword(char *start, char *end) return -1; } -/* +/* * Parse an assertion. Set keynote_errno to ERROR_SYNTAX if parsing * failed due to certificate badness, and ERROR_MEMORY if memory * problem. If more than one assertions have been passed in the @@ -457,7 +457,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags) } /* If two newlines, end of assertion */ - if ((as->as_buf[i] == '\n') && (i + 1 < j) && + if ((as->as_buf[i] == '\n') && (i + 1 < j) && (as->as_buf[i + 1] == '\n')) { end_of_assertion = 1; @@ -466,7 +466,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags) } /* If newline followed by non-whitespace or comment character */ - if ((as->as_buf[i] == '\n') && + if ((as->as_buf[i] == '\n') && (!isspace((unsigned char)as->as_buf[i + 1])) && (as->as_buf[i + 1] != '#')) { @@ -477,7 +477,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags) i++; - /* + /* * On each of the cases (except the first), we check that: * - we've already seen a keynote-version field (and that * it's the first one that appears in the assertion) @@ -597,7 +597,7 @@ keynote_parse_assertion(char *buf, int len, int assertion_flags) break; /* Check whether there's something else following */ - for (k = 1; te + k < as->as_buf + len && *(te + k) != '\n'; k++) + for (k = 1; te + k < as->as_buf + len && *(te + k) != '\n'; k++) if (!isspace((unsigned char)*(te + k))) { keynote_free_assertion(as); diff --git a/lib/libkeynote/sample-app.c b/lib/libkeynote/sample-app.c index bfa558671..2768c42f6 100644 --- a/lib/libkeynote/sample-app.c +++ b/lib/libkeynote/sample-app.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -77,7 +77,7 @@ char credential_assertions[] = " GiIX73T6p9eExpyHZbfjxPxXEIf6tbBre6x2Y26wBQCx/yCj5\\\n" \ " 4IS3tuY2w==\"\n"; -char action_authorizer[] = +char action_authorizer[] = "dsa-hex:3081de02402121e160209f7ecef1b6866c907e8d" \ "d65e9a67ef0fbd6ece7760b7c8bb0d9a0b71a0dd921b949f0" \ "9a16092eb3f50e33892bc3e9f1c8409f5298de40461493ef1" \ @@ -93,7 +93,7 @@ char action_authorizer[] = char *returnvalues[NUM_RETURN_VALUES]; -/* +/* * Sample application. We do the following: * - create a session * - read a "file" with our KeyNote policy assertions @@ -155,7 +155,7 @@ main(int argc, char **argv) } /* - * We no longer need a copy of policy_assertions, so we could + * We no longer need a copy of policy_assertions, so we could * free it here. */ @@ -234,7 +234,7 @@ main(int argc, char **argv) } /* - * We no longer need a copy of credential_assertions, so we could + * We no longer need a copy of credential_assertions, so we could * free it here. */ diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c index d4123caea..74b0500a0 100644 --- a/lib/libkeynote/signature.c +++ b/lib/libkeynote/signature.c @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO @@ -46,17 +46,17 @@ static const char hextab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' -}; +}; /* * Actual conversion to hex. - */ + */ static void bin2hex(unsigned char *data, unsigned char *buffer, int len) { int off = 0; - - while(len > 0) + + while(len > 0) { buffer[off++] = hextab[*data >> 4]; buffer[off++] = hextab[*data & 0xF]; @@ -257,7 +257,7 @@ keynote_get_sig_algorithm(char *sig, int *hash, int *enc, int *internal) /* * Map a key to an algorithm. Return algorithm number (defined in - * keynote.h), or KEYNOTE_ALGORITHM_NONE if unknown. + * keynote.h), or KEYNOTE_ALGORITHM_NONE if unknown. * This latter is also a valid algorithm (for logical tags). Also return * in the second and third arguments the ASCII and internal encodings. */ @@ -312,14 +312,14 @@ keynote_get_key_algorithm(char *key, int *encoding, int *internalencoding) *encoding = ENCODING_HEX; return KEYNOTE_ALGORITHM_BINARY; } - + if (!strncasecmp(BINARY_BASE64, key, BINARY_BASE64_LEN)) { *internalencoding = INTERNAL_ENC_NONE; *encoding = ENCODING_BASE64; return KEYNOTE_ALGORITHM_BINARY; } - + *internalencoding = INTERNAL_ENC_NONE; *encoding = ENCODING_NONE; return KEYNOTE_ALGORITHM_NONE; @@ -333,7 +333,7 @@ static int keynote_get_private_key_algorithm(char *key, int *encoding, int *internalencoding) { - if (strncasecmp(KEYNOTE_PRIVATE_KEY_PREFIX, key, + if (strncasecmp(KEYNOTE_PRIVATE_KEY_PREFIX, key, KEYNOTE_PRIVATE_KEY_PREFIX_LEN)) { *internalencoding = INTERNAL_ENC_NONE; @@ -571,7 +571,7 @@ kn_keycompare(void *key1, void *key2, int algorithm) return RESULT_TRUE; else return RESULT_FALSE; - + case KEYNOTE_ALGORITHM_DSA: p1 = (DSA *) key1; p2 = (DSA *) key2; @@ -671,11 +671,11 @@ keynote_sigverify_assertion(struct assertion *as) SHA1_Init(&shscontext); SHA1_Update(&shscontext, as->as_startofsignature, as->as_allbutsignature - as->as_startofsignature); - SHA1_Update(&shscontext, as->as_signature, + SHA1_Update(&shscontext, as->as_signature, (char *) sig - as->as_signature); SHA1_Final(res2, &shscontext); break; - + case KEYNOTE_HASH_MD5: hashlen = 16; memset(res2, 0, hashlen); @@ -727,7 +727,7 @@ keynote_sigverify_assertion(struct assertion *as) break; case ENCODING_NATIVE: - + if ((decoded = strdup(sig)) == NULL) { keynote_errno = ERROR_MEMORY; return -1; @@ -771,9 +771,9 @@ keynote_sigverify_assertion(struct assertion *as) return SIGRESULT_TRUE; } } - + /* Handle more algorithms here */ - + free(ptr); return SIGRESULT_FALSE; @@ -845,7 +845,7 @@ keynote_sign_assertion(struct assertion *as, char *sigalg, void *key, SHA1_Update(&shscontext, sigalg, (char *) sig - sigalg); SHA1_Final(res2, &shscontext); break; - + case KEYNOTE_HASH_MD5: hashlen = 16; memset(res2, 0, hashlen); @@ -913,7 +913,7 @@ keynote_sign_assertion(struct assertion *as, char *sigalg, void *key, keynote_errno = ERROR_SYNTAX; return NULL; } - + if (BIO_write(biokey, key, strlen(key) + 1) <= 0) { BIO_free(biokey); diff --git a/lib/libkeynote/signature.h b/lib/libkeynote/signature.h index 0bfe88343..1f5a9154c 100644 --- a/lib/libkeynote/signature.h +++ b/lib/libkeynote/signature.h @@ -6,11 +6,11 @@ * in April-May 1998 * * Copyright (C) 1998, 1999 by Angelos D. Keromytis. - * + * * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO diff --git a/lib/libkeynote/testsuite/auth4 b/lib/libkeynote/testsuite/auth4 index 776d0fb60..6084bdc38 100644 --- a/lib/libkeynote/testsuite/auth4 +++ b/lib/libkeynote/testsuite/auth4 @@ -1,4 +1,4 @@ - # Comments are allowed + # Comments are allowed "dsa-hex:3081df02410082b9dc3a9671aa7f7595f15987a9\ f9a9d0fbe23540d193c342469fc7076fb71a5ef0abdd67e5f\ ad884862ae62b1fcf5a89c99e060b16b80b2c0b07ffb9dc66\ diff --git a/lib/libkeynote/testsuite/test-assertion1 b/lib/libkeynote/testsuite/test-assertion1 index 0828cdf09..13d53ce38 100644 --- a/lib/libkeynote/testsuite/test-assertion1 +++ b/lib/libkeynote/testsuite/test-assertion1 @@ -36,11 +36,11 @@ conditions: app_domain == "testing" -> b63bdcda576e5eeecfb68930a5c3ca8df71d84fd0e" && @(foo) == @foo && "this string contains a newline\n\ - \ followed by one space." == + \ followed by one space." == "this\ string\ contains\ a\ newline\n\ foll\ owed\ by\ one\ space\." && "this string contains a newline\n\ \ - followed by one space." == + followed by one space." == "this string contains a newline\012\040followed by one space." && request == "test" -> "true"; # this is another comment request == "whatever3" -> "true"; diff --git a/lib/libkeynote/testsuite/test-assertion1-signed.in b/lib/libkeynote/testsuite/test-assertion1-signed.in index b3eb754b0..3d1c8daac 100644 --- a/lib/libkeynote/testsuite/test-assertion1-signed.in +++ b/lib/libkeynote/testsuite/test-assertion1-signed.in @@ -32,11 +32,11 @@ conditions: app_domain == "testing" -> b63bdcda576e5eeecfb68930a5c3ca8df71d84fd0e" && @(foo) == @foo && "this string contains a newline\n\ - \ followed by one space." == + \ followed by one space." == "this\ string\ contains\ a\ newline\n\ foll\ owed\ by\ one\ space\." && "this string contains a newline\n\ \ - followed by one space." == + followed by one space." == "this string contains a newline\012\040followed by one space." && request == "test" -> "true"; # this is another comment request == "whatever3" -> "true"; diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c index a1f1f9197..15af5aa38 100644 --- a/lib/libkvm/kvm_file2.c +++ b/lib/libkvm/kvm_file2.c @@ -683,7 +683,7 @@ fill_file(kvm_t *kd, struct kinfo_file *kf, struct file *fp, u_long fpaddr, memcpy(kf->unp_path, un.sun_path, un.sun_len - offsetof(struct sockaddr_un,sun_path)); } - + break; } } diff --git a/lib/libkvm/kvm_proc2.c b/lib/libkvm/kvm_proc2.c index a9368345d..a9d156032 100644 --- a/lib/libkvm/kvm_proc2.c +++ b/lib/libkvm/kvm_proc2.c @@ -343,7 +343,7 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct process *pr, kp.p_pctcpu = 0; kp.p_stat = (process.ps_flags & PS_ZOMBIE) ? SDEAD : SIDL; - for (p = TAILQ_FIRST(&process.ps_threads); p != NULL; + for (p = TAILQ_FIRST(&process.ps_threads); p != NULL; p = TAILQ_NEXT(&proc, p_thr_link)) { if (KREAD(kd, (u_long)p, &proc)) { _kvm_err(kd, kd->program, @@ -378,7 +378,7 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct process *pr, if (!dothreads) continue; - for (p = TAILQ_FIRST(&process.ps_threads); p != NULL; + for (p = TAILQ_FIRST(&process.ps_threads); p != NULL; p = TAILQ_NEXT(&proc, p_thr_link)) { if (KREAD(kd, (u_long)p, &proc)) { _kvm_err(kd, kd->program, diff --git a/lib/libm/arch/i387/e_acos.S b/lib/libm/arch/i387/e_acos.S index 2492b0658..1a4c78368 100644 --- a/lib/libm/arch/i387/e_acos.S +++ b/lib/libm/arch/i387/e_acos.S @@ -11,7 +11,7 @@ ENTRY(acos) fldl 4(%esp) /* x */ fst %st(1) fmul %st(0) /* x^2 */ - fld1 + fld1 fsubp /* 1 - x^2 */ fsqrt /* sqrt (1 - x^2) */ fxch %st(1) diff --git a/lib/libm/arch/i387/e_exp.S b/lib/libm/arch/i387/e_exp.S index d747010de..63a0a2b1e 100644 --- a/lib/libm/arch/i387/e_exp.S +++ b/lib/libm/arch/i387/e_exp.S @@ -70,7 +70,7 @@ ENTRY(exp) frndint /* int(x * log2(e)) */ fst %st(2) fsubrp /* fract(x * log2(e)) */ - f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ fld1 faddp /* 2^(fract(x * log2(e))) */ fscale /* e^x */ diff --git a/lib/libm/arch/i387/s_cos.S b/lib/libm/arch/i387/s_cos.S index cd22d5d27..af37a3489 100644 --- a/lib/libm/arch/i387/s_cos.S +++ b/lib/libm/arch/i387/s_cos.S @@ -12,7 +12,7 @@ ENTRY(cos) fnstsw %ax andw $0x400,%ax jnz 1f - ret + ret 1: fldpi fadd %st(0) fxch %st(1) diff --git a/lib/libm/arch/i387/s_cosf.S b/lib/libm/arch/i387/s_cosf.S index e68621965..21b730953 100644 --- a/lib/libm/arch/i387/s_cosf.S +++ b/lib/libm/arch/i387/s_cosf.S @@ -10,5 +10,5 @@ ENTRY(cosf) flds 4(%esp) fcos - ret + ret END_STD(cosf) diff --git a/lib/libm/arch/i387/s_llrint.S b/lib/libm/arch/i387/s_llrint.S index 0e7548303..c83bb8a91 100644 --- a/lib/libm/arch/i387/s_llrint.S +++ b/lib/libm/arch/i387/s_llrint.S @@ -25,7 +25,7 @@ */ #include - + ENTRY(llrint) fldl 4(%esp) subl $8,%esp diff --git a/lib/libm/arch/i387/s_llrintf.S b/lib/libm/arch/i387/s_llrintf.S index 4c21839e3..2927cb97f 100644 --- a/lib/libm/arch/i387/s_llrintf.S +++ b/lib/libm/arch/i387/s_llrintf.S @@ -25,7 +25,7 @@ */ #include "DEFS.h" - + ENTRY(llrintf) flds 4(%esp) subl $8,%esp diff --git a/lib/libm/arch/i387/s_log1p.S b/lib/libm/arch/i387/s_log1p.S index 4f90f8ce2..c6ede30c5 100644 --- a/lib/libm/arch/i387/s_log1p.S +++ b/lib/libm/arch/i387/s_log1p.S @@ -34,7 +34,7 @@ * which can be done with just one conditional branch. If x is * inside this range, we use fyl2xp1. Outside of this range, * the use of fyl2x is accurate enough. - * + * */ ENTRY(log1p) diff --git a/lib/libm/arch/i387/s_log1pf.S b/lib/libm/arch/i387/s_log1pf.S index 3f6ac2942..74bd67e44 100644 --- a/lib/libm/arch/i387/s_log1pf.S +++ b/lib/libm/arch/i387/s_log1pf.S @@ -9,7 +9,7 @@ /* * Since the fyl2xp1 instruction has such a limited range: * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * it's not worth trying to use it. */ ENTRY(log1pf) diff --git a/lib/libm/arch/i387/s_lrint.S b/lib/libm/arch/i387/s_lrint.S index 848f6d2cb..08cd7e225 100644 --- a/lib/libm/arch/i387/s_lrint.S +++ b/lib/libm/arch/i387/s_lrint.S @@ -25,7 +25,7 @@ */ #include - + ENTRY(lrint) fldl 4(%esp) subl $4,%esp diff --git a/lib/libm/arch/i387/s_lrintf.S b/lib/libm/arch/i387/s_lrintf.S index 329bb3c61..ad6ee3a15 100644 --- a/lib/libm/arch/i387/s_lrintf.S +++ b/lib/libm/arch/i387/s_lrintf.S @@ -25,7 +25,7 @@ */ #include - + ENTRY(lrintf) flds 4(%esp) subl $4,%esp diff --git a/lib/libm/src/e_acos.c b/lib/libm/src/e_acos.c index e79fe2977..a994caeca 100644 --- a/lib/libm/src/e_acos.c +++ b/lib/libm/src/e_acos.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* acos(x) - * Method : + * Method : * acos(x) = pi/2 - asin(x) * acos(-x) = pi/2 + asin(x) * For |x|<=0.5 * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) * For x>0.5 * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) - * = 2asin(sqrt((1-x)/2)) + * = 2asin(sqrt((1-x)/2)) * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) * = 2f + (2c + 2s*z*R(z)) * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term @@ -39,7 +39,7 @@ #include "math_private.h" -static const double +static const double one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ diff --git a/lib/libm/src/e_acosf.c b/lib/libm/src/e_acosf.c index 559c2c34b..2f2d8a2be 100644 --- a/lib/libm/src/e_acosf.c +++ b/lib/libm/src/e_acosf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0000000000e+00, /* 0x3F800000 */ pi = 3.1415925026e+00, /* 0x40490fda */ pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ diff --git a/lib/libm/src/e_acosh.c b/lib/libm/src/e_acosh.c index 54f7a46e4..427103ef6 100644 --- a/lib/libm/src/e_acosh.c +++ b/lib/libm/src/e_acosh.c @@ -5,14 +5,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* acosh(x) * Method : - * Based on + * Based on * acosh(x) = log [ x + sqrt(x*x-1) ] * we have * acosh(x) := log(x)+ln2, if x is large; else @@ -29,13 +29,13 @@ #include "math_private.h" -static const double +static const double one = 1.0, ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ double acosh(double x) -{ +{ double t; int32_t hx; u_int32_t lx; @@ -45,7 +45,7 @@ acosh(double x) } else if(hx >=0x41b00000) { /* x > 2**28 */ if(hx >=0x7ff00000) { /* x is inf of NaN */ return x+x; - } else + } else return log(x)+ln2; /* acosh(huge)=log(2x) */ } else if(((hx-0x3ff00000)|lx)==0) { return 0.0; /* acosh(1) = 0 */ diff --git a/lib/libm/src/e_acoshf.c b/lib/libm/src/e_acoshf.c index 175f13e67..b6fbd2c14 100644 --- a/lib/libm/src/e_acoshf.c +++ b/lib/libm/src/e_acoshf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,13 +16,13 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0, ln2 = 6.9314718246e-01; /* 0x3f317218 */ float acoshf(float x) -{ +{ float t; int32_t hx; GET_FLOAT_WORD(hx,x); @@ -31,7 +31,7 @@ acoshf(float x) } else if(hx >=0x4d800000) { /* x > 2**28 */ if(hx >=0x7f800000) { /* x is inf of NaN */ return x+x; - } else + } else return logf(x)+ln2; /* acosh(huge)=log(2x) */ } else if (hx==0x3f800000) { return 0.0; /* acosh(1) = 0 */ diff --git a/lib/libm/src/e_acosl.c b/lib/libm/src/e_acosl.c index 7e00b504d..cb8ea3d8c 100644 --- a/lib/libm/src/e_acosl.c +++ b/lib/libm/src/e_acosl.c @@ -7,7 +7,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/e_asin.c b/lib/libm/src/e_asin.c index 946431d3a..9c342f2e1 100644 --- a/lib/libm/src/e_asin.c +++ b/lib/libm/src/e_asin.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* asin(x) - * Method : + * Method : * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... * we approximate asin(x) on [0,0.5] by * asin(x) = x + x*x^2*R(x^2) * where - * R(x^2) is a rational approximation of (asin(x)-x)/x^3 + * R(x^2) is a rational approximation of (asin(x)-x)/x^3 * and its Remes error is bounded by * |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75) * @@ -45,7 +45,7 @@ #include "math_private.h" -static const double +static const double one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ huge = 1.000e+300, pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ @@ -75,8 +75,8 @@ asin(double x) GET_LOW_WORD(lx,x); if(((ix-0x3ff00000)|lx)==0) /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + return x*pio2_hi+x*pio2_lo; + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3fe00000) { /* |x|<0.5 */ if(ix<0x3e400000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ @@ -104,8 +104,8 @@ asin(double x) p = 2.0*s*r-(pio2_lo-2.0*c); q = pio4_hi-2.0*w; t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; + } + if(hx>0) return t; else return -t; } DEF_STD(asin); LDBL_MAYBE_CLONE(asin); diff --git a/lib/libm/src/e_asinf.c b/lib/libm/src/e_asinf.c index 248baa650..9a84f5707 100644 --- a/lib/libm/src/e_asinf.c +++ b/lib/libm/src/e_asinf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0000000000e+00, /* 0x3F800000 */ huge = 1.000e+30, pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ @@ -43,9 +43,9 @@ asinf(float x) ix = hx&0x7fffffff; if(ix==0x3f800000) { /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; + return x*pio2_hi+x*pio2_lo; } else if(ix> 0x3f800000) { /* |x|>= 1 */ - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3f000000) { /* |x|<0.5 */ if(ix<0x32000000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ @@ -75,7 +75,7 @@ asinf(float x) p = (float)2.0*s*r-(pio2_lo-(float)2.0*c); q = pio4_hi-(float)2.0*w; t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; + } + if(hx>0) return t; else return -t; } DEF_STD(asinf); diff --git a/lib/libm/src/e_asinl.c b/lib/libm/src/e_asinl.c index b281ba456..7db82ce1c 100644 --- a/lib/libm/src/e_asinl.c +++ b/lib/libm/src/e_asinl.c @@ -7,7 +7,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -56,8 +56,8 @@ asinl(long double x) #endif /* EXT_FRACLMBITS */ | u.bits.ext_fracl)==0) /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + return x*pio2_hi+x*pio2_lo; + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (exptone) return x;/* return x with inexact if x!=0*/ @@ -95,7 +95,7 @@ asinl(long double x) p = 2.0*s*r-(pio2_lo-2.0*c); q = pio4_hi-2.0*w; t = pio4_hi-(p-q); - } - if(expsign>0) return t; else return -t; + } + if(expsign>0) return t; else return -t; } DEF_STD(asinl); diff --git a/lib/libm/src/e_atan2.c b/lib/libm/src/e_atan2.c index 0d489e1e6..0c97de5e6 100644 --- a/lib/libm/src/e_atan2.c +++ b/lib/libm/src/e_atan2.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -13,7 +13,7 @@ /* atan2(y,x) * Method : * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). - * 2. Reduce x to positive by (if x and y are unexceptional): + * 2. Reduce x to positive by (if x and y are unexceptional): * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, * @@ -31,9 +31,9 @@ * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -42,7 +42,7 @@ #include "math_private.h" -static const double +static const double tiny = 1.0e-300, zero = 0.0, pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ @@ -52,7 +52,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ double atan2(double y, double x) -{ +{ double z; int32_t k,m,hx,hy,ix,iy; u_int32_t lx,ly; @@ -70,7 +70,7 @@ atan2(double y, double x) /* when y = 0 */ if((iy|ly)==0) { switch(m) { - case 0: + case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ @@ -78,7 +78,7 @@ atan2(double y, double x) } /* when x = 0 */ if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - + /* when x is INF */ if(ix==0x7ff00000) { if(iy==0x7ff00000) { diff --git a/lib/libm/src/e_atan2f.c b/lib/libm/src/e_atan2f.c index c14752b87..65af936a7 100644 --- a/lib/libm/src/e_atan2f.c +++ b/lib/libm/src/e_atan2f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float tiny = 1.0e-30, zero = 0.0, pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ @@ -26,7 +26,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */ float atan2f(float y, float x) -{ +{ float z; int32_t k,m,hx,hy,ix,iy; @@ -43,7 +43,7 @@ atan2f(float y, float x) /* when y = 0 */ if(iy==0) { switch(m) { - case 0: + case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ @@ -51,7 +51,7 @@ atan2f(float y, float x) } /* when x = 0 */ if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - + /* when x is INF */ if(ix==0x7f800000) { if(iy==0x7f800000) { diff --git a/lib/libm/src/e_atan2l.c b/lib/libm/src/e_atan2l.c index 5261c0eb3..3335654f9 100644 --- a/lib/libm/src/e_atan2l.c +++ b/lib/libm/src/e_atan2l.c @@ -7,7 +7,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * @@ -106,7 +106,7 @@ atan2l(long double y, long double x) #endif /* EXT_FRACLMBITS */ | uy.bits.ext_fracl)==0) { switch(m) { - case 0: + case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ diff --git a/lib/libm/src/e_atanh.c b/lib/libm/src/e_atanh.c index 80da1b36b..d1686badc 100644 --- a/lib/libm/src/e_atanh.c +++ b/lib/libm/src/e_atanh.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -17,7 +17,7 @@ * 1 2x x * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x - * + * * For x<0.5 * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) * @@ -46,14 +46,14 @@ atanh(double x) ix = hx&0x7fffffff; if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */ return (x-x)/(x-x); - if(ix==0x3ff00000) + if(ix==0x3ff00000) return x/zero; if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */ SET_HIGH_WORD(x,ix); if(ix<0x3fe00000) { /* x < 0.5 */ t = x+x; t = 0.5*log1p(t+t*x/(one-x)); - } else + } else t = 0.5*log1p((x+x)/(one-x)); if(hx>=0) return t; else return -t; } diff --git a/lib/libm/src/e_atanhf.c b/lib/libm/src/e_atanhf.c index dc7eb9aee..f4978291b 100644 --- a/lib/libm/src/e_atanhf.c +++ b/lib/libm/src/e_atanhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -28,14 +28,14 @@ atanhf(float x) ix = hx&0x7fffffff; if (ix>0x3f800000) /* |x|>1 */ return (x-x)/(x-x); - if(ix==0x3f800000) + if(ix==0x3f800000) return x/zero; if(ix<0x31800000&&(huge+x)>zero) return x; /* x<2**-28 */ SET_FLOAT_WORD(x,ix); if(ix<0x3f000000) { /* x < 0.5 */ t = x+x; t = (float)0.5*log1pf(t+t*x/(one-x)); - } else + } else t = (float)0.5*log1pf((x+x)/(one-x)); if(hx>=0) return t; else return -t; } diff --git a/lib/libm/src/e_cosh.c b/lib/libm/src/e_cosh.c index dcf6fa626..1ab2ee5df 100644 --- a/lib/libm/src/e_cosh.c +++ b/lib/libm/src/e_cosh.c @@ -5,24 +5,24 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* cosh(x) - * Method : + * Method : * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 - * 1. Replace x by |x| (cosh(x) = cosh(-x)). - * 2. - * [ exp(x) - 1 ]^2 + * 1. Replace x by |x| (cosh(x) = cosh(-x)). + * 2. + * [ exp(x) - 1 ]^2 * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- * 2*exp(x) * * exp(x) + 1/exp(x) * ln2/2 <= x <= 22 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovft : cosh(x) := exp(x)/2 + * 22 <= x <= lnovft : cosh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : cosh(x) := huge*huge (overflow) * @@ -40,7 +40,7 @@ static const double one = 1.0, half=0.5, huge = 1.0e300; double cosh(double x) -{ +{ double t,w; int32_t ix; u_int32_t lx; @@ -50,7 +50,7 @@ cosh(double x) ix &= 0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) return x*x; + if(ix>=0x7ff00000) return x*x; /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ if(ix<0x3fd62e43) { @@ -71,7 +71,7 @@ cosh(double x) /* |x| in [log(maxdouble), overflowthresold] */ GET_LOW_WORD(lx,x); - if (ix<0x408633CE || + if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { w = exp(half*fabs(x)); t = half*w; diff --git a/lib/libm/src/e_coshf.c b/lib/libm/src/e_coshf.c index 9c6436070..499cd8fc9 100644 --- a/lib/libm/src/e_coshf.c +++ b/lib/libm/src/e_coshf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -21,7 +21,7 @@ static const float one = 1.0, half=0.5; float coshf(float x) -{ +{ float t,w; int32_t ix; @@ -29,7 +29,7 @@ coshf(float x) ix &= 0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x*x; + if(ix>=0x7f800000) return x*x; /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ if(ix<0x3eb17218) { diff --git a/lib/libm/src/e_exp.c b/lib/libm/src/e_exp.c index d158468e0..3359f84df 100644 --- a/lib/libm/src/e_exp.c +++ b/lib/libm/src/e_exp.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -18,36 +18,36 @@ * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658. * Given x, find r and integer k such that * - * x = k*ln2 + r, |r| <= 0.5*ln2. + * x = k*ln2 + r, |r| <= 0.5*ln2. * - * Here r will be represented as r = hi-lo for better + * Here r will be represented as r = hi-lo for better * accuracy. * * 2. Approximation of exp(r) by a special rational function on * the interval [0,0.34658]: * Write * R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ... - * We use a special Remes algorithm on [0,0.34658] to generate - * a polynomial of degree 5 to approximate R. The maximum error + * We use a special Remes algorithm on [0,0.34658] to generate + * a polynomial of degree 5 to approximate R. The maximum error * of this polynomial approximation is bounded by 2**-59. In * other words, * R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5 * (where z=r*r, and the values of P1 to P5 are listed below) * and * | 5 | -59 - * | 2.0+P1*z+...+P5*z - R(z) | <= 2 + * | 2.0+P1*z+...+P5*z - R(z) | <= 2 * | | * The computation of exp(r) thus becomes * 2*r * exp(r) = 1 + ------- * R - r - * r*R1(r) + * r*R1(r) * = 1 + r + ----------- (for better accuracy) * 2 - R1(r) * where * 2 4 10 * R1(r) = r - (P1*r + P2*r + ... + P5*r ). - * + * * 3. Scale back to obtain exp(x): * From step 1, we have * exp(x) = 2^k * exp(r) @@ -62,13 +62,13 @@ * 1 ulp (unit in the last place). * * Misc. info. - * For IEEE double + * For IEEE double * if x > 7.09782712893383973096e+02 then exp(x) overflow * if x < -7.45133219101941108420e+02 then exp(x) underflow * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -113,7 +113,7 @@ exp(double x) /* default IEEE double exp */ if(hx>=0x7ff00000) { u_int32_t lx; GET_LOW_WORD(lx,x); - if(((hx&0xfffff)|lx)!=0) + if(((hx&0xfffff)|lx)!=0) return x+x; /* NaN */ else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ } @@ -122,7 +122,7 @@ exp(double x) /* default IEEE double exp */ } /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; } else { @@ -132,7 +132,7 @@ exp(double x) /* default IEEE double exp */ lo = t*ln2LO[0]; } x = hi - lo; - } + } else if(hx < 0x3e300000) { /* when |x|<2**-28 */ if(huge+x>one) return one+x;/* trigger inexact */ } @@ -141,7 +141,7 @@ exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) return one-((x*c)/(c-2.0)-x); + if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); if(k >= -1021) { u_int32_t hy; diff --git a/lib/libm/src/e_expf.c b/lib/libm/src/e_expf.c index 1d749c3ee..7da8cf138 100644 --- a/lib/libm/src/e_expf.c +++ b/lib/libm/src/e_expf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -58,7 +58,7 @@ expf(float x) /* default IEEE double exp */ } /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; } else { @@ -68,7 +68,7 @@ expf(float x) /* default IEEE double exp */ lo = t*ln2LO[0]; } x = hi - lo; - } + } else if(hx < 0x31800000) { /* when |x|<2**-28 */ if(huge+x>one) return one+x;/* trigger inexact */ } @@ -76,7 +76,7 @@ expf(float x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) return one-((x*c)/(c-(float)2.0)-x); + if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); if(k >= -125) { u_int32_t hy; diff --git a/lib/libm/src/e_fmod.c b/lib/libm/src/e_fmod.c index 8c8d52fa9..395a9c960 100644 --- a/lib/libm/src/e_fmod.c +++ b/lib/libm/src/e_fmod.c @@ -5,12 +5,12 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * fmod(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -41,7 +41,7 @@ fmod(double x, double y) return (x*y)/(x*y); if(hx<=hy) { if((hx>31]; /* |x|=|y| return x*0*/ } @@ -64,7 +64,7 @@ fmod(double x, double y) } else iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) + if(ix >= -1022) hx = 0x00100000|(0x000fffff&hx); else { /* subnormal x, shift x to normal */ n = -1022-ix; @@ -76,7 +76,7 @@ fmod(double x, double y) lx = 0; } } - if(iy >= -1022) + if(iy >= -1022) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; @@ -105,7 +105,7 @@ fmod(double x, double y) /* convert back to floating value and restore the sign */ if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + return Zero[(u_int32_t)sx>>31]; while(hx<0x00100000) { /* normalize x */ hx = hx+hx+(lx>>31); lx = lx+lx; iy -= 1; diff --git a/lib/libm/src/e_fmodf.c b/lib/libm/src/e_fmodf.c index 28a86d50d..01e838eda 100644 --- a/lib/libm/src/e_fmodf.c +++ b/lib/libm/src/e_fmodf.c @@ -8,12 +8,12 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * fmodf(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -54,13 +54,13 @@ fmodf(float x, float y) } else iy = (hy>>23)-127; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) + if(ix >= -126) hx = 0x00800000|(0x007fffff&hx); else { /* subnormal x, shift x to normal */ n = -126-ix; hx = hx<= -126) + if(iy >= -126) hy = 0x00800000|(0x007fffff&hy); else { /* subnormal y, shift y to normal */ n = -126-iy; @@ -83,7 +83,7 @@ fmodf(float x, float y) /* convert back to floating value and restore the sign */ if(hx==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + return Zero[(u_int32_t)sx>>31]; while(hx<0x00800000) { /* normalize x */ hx = hx+hx; iy -= 1; diff --git a/lib/libm/src/e_hypot.c b/lib/libm/src/e_hypot.c index cd74752bc..fa4977aa5 100644 --- a/lib/libm/src/e_hypot.c +++ b/lib/libm/src/e_hypot.c @@ -5,19 +5,19 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* hypot(x,y) * - * Method : - * If (assume round-to-nearest) z=x*x+y*y - * has error less than sqrt(2)/2 ulp, than + * Method : + * If (assume round-to-nearest) z=x*x+y*y + * has error less than sqrt(2)/2 ulp, than * sqrt(z) has error less than 1 ulp (exercise). * - * So, compute sqrt(x*x+y*y) with some care as + * So, compute sqrt(x*x+y*y) with some care as * follows to get the error below 1 ulp: * * Assume x>y>0; @@ -27,10 +27,10 @@ * where x1 = x with lower 32 bits cleared, x2 = x-x1; else * 2. if x <= 2y use * t1*yy1+((x-y)*(x-y)+(t1*y2+t2*y)) - * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, + * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, * yy1= y with lower 32 bits chopped, y2 = y-yy1. - * - * NOTE: scaling may be necessary if some argument is too + * + * NOTE: scaling may be necessary if some argument is too * large or too tiny * * Special cases: @@ -38,8 +38,8 @@ * hypot(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypot(x,y) returns sqrt(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypot(x,y) returns sqrt(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include @@ -78,7 +78,7 @@ hypot(double x, double y) SET_HIGH_WORD(b,hb); } if(hb < 0x20b00000) { /* b < 2**-500 */ - if(hb <= 0x000fffff) { /* subnormal b or 0 */ + if(hb <= 0x000fffff) { /* subnormal b or 0 */ u_int32_t low; GET_LOW_WORD(low,b); if((hb|low)==0) return a; diff --git a/lib/libm/src/e_hypotf.c b/lib/libm/src/e_hypotf.c index 8b07b2965..82242f3a7 100644 --- a/lib/libm/src/e_hypotf.c +++ b/lib/libm/src/e_hypotf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -44,7 +44,7 @@ hypotf(float x, float y) SET_FLOAT_WORD(b,hb); } if(hb < 0x26800000) { /* b < 2**-50 */ - if(hb <= 0x007fffff) { /* subnormal b or 0 */ + if(hb <= 0x007fffff) { /* subnormal b or 0 */ if(hb==0) return a; SET_FLOAT_WORD(t1,0x7e800000); /* t1=2^126 */ b *= t1; diff --git a/lib/libm/src/e_j0.c b/lib/libm/src/e_j0.c index 50bcdbd00..c997161ed 100644 --- a/lib/libm/src/e_j0.c +++ b/lib/libm/src/e_j0.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -29,20 +29,20 @@ * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j0(nan)= nan * j0(0) = 1 * j0(inf) = 0 - * + * * Method -- y0(x): * 1. For x<2. - * Since + * Since * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. * We use the following function to approximate y0, * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where + * where * U(z) = u00 + u01*z + ... + u06*z^6 * V(z) = 1 + v01*z + ... + v04*z^4 * with absolute approximation error bounded by 2**-72. @@ -60,7 +60,7 @@ static double pzero(double), qzero(double); -static const double +static const double huge = 1e300, one = 1.0, invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ @@ -78,7 +78,7 @@ S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */ static const double zero = 0.0; double -j0(double x) +j0(double x) { double z, s,c,ss,cc,r,u,v; int32_t hx,ix; @@ -140,7 +140,7 @@ v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ double -y0(double x) +y0(double x) { double z, s,c,ss,cc,u,v; int32_t hx,ix,lx; @@ -148,7 +148,7 @@ y0(double x) EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); + if(ix>=0x7ff00000) return one/(x+x*x); if((ix|lx)==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -283,7 +283,7 @@ pzero(double x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/src/e_j0f.c b/lib/libm/src/e_j0f.c index 6e00b91a6..d49dd8976 100644 --- a/lib/libm/src/e_j0f.c +++ b/lib/libm/src/e_j0f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -18,7 +18,7 @@ static float pzerof(float), qzerof(float); -static const float +static const float huge = 1e30, one = 1.0, invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ @@ -36,7 +36,7 @@ S04 = 1.1661400734e-09; /* 0x30a045e8 */ static const float zero = 0.0; float -j0f(float x) +j0f(float x) { float z, s,c,ss,cc,r,u,v; int32_t hx,ix; @@ -98,7 +98,7 @@ v03 = 2.5915085189e-07, /* 0x348b216c */ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ float -y0f(float x) +y0f(float x) { float z, s,c,ss,cc,u,v; int32_t hx,ix; @@ -106,7 +106,7 @@ y0f(float x) GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); + if(ix>=0x7f800000) return one/(x+x*x); if(ix==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -240,7 +240,7 @@ pzerof(float x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/src/e_j1.c b/lib/libm/src/e_j1.c index 1e9cf1039..d726e8ae3 100644 --- a/lib/libm/src/e_j1.c +++ b/lib/libm/src/e_j1.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -30,16 +30,16 @@ * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j1(nan)= nan * j1(0) = 0 * j1(inf) = 0 - * + * * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN * 2. For x<2. - * Since + * Since * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. * We use the following function to approximate y1, @@ -60,7 +60,7 @@ static double pone(double), qone(double); -static const double +static const double huge = 1e300, one = 1.0, invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ @@ -79,7 +79,7 @@ s05 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */ static const double zero = 0.0; double -j1(double x) +j1(double x) { double z, s,c,ss,cc,r,u,v,y; int32_t hx,ix; @@ -137,7 +137,7 @@ static const double V0[5] = { }; double -y1(double x) +y1(double x) { double z, s,c,ss,cc,u,v; int32_t hx,ix,lx; @@ -145,7 +145,7 @@ y1(double x) EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); + if(ix>=0x7ff00000) return one/(x+x*x); if((ix|lx)==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -175,10 +175,10 @@ y1(double x) z = invsqrtpi*(u*ss+v*cc)/sqrt(x); } return z; - } + } if(ix<=0x3c900000) { /* x < 2**-54 */ return(-tpi/x); - } + } z = x*x; u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); @@ -277,7 +277,7 @@ pone(double x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/src/e_j1f.c b/lib/libm/src/e_j1f.c index 290cf1e36..81b4598dc 100644 --- a/lib/libm/src/e_j1f.c +++ b/lib/libm/src/e_j1f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -18,7 +18,7 @@ static float ponef(float), qonef(float); -static const float +static const float huge = 1e30, one = 1.0, invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ @@ -37,7 +37,7 @@ s05 = 1.2354227016e-11; /* 0x2d59567e */ static const float zero = 0.0; float -j1f(float x) +j1f(float x) { float z, s,c,ss,cc,r,u,v,y; int32_t hx,ix; @@ -95,7 +95,7 @@ static const float V0[5] = { }; float -y1f(float x) +y1f(float x) { float z, s,c,ss,cc,u,v; int32_t hx,ix; @@ -103,7 +103,7 @@ y1f(float x) GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); + if(ix>=0x7f800000) return one/(x+x*x); if(ix==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -133,10 +133,10 @@ y1f(float x) z = invsqrtpi*(u*ss+v*cc)/sqrtf(x); } return z; - } + } if(ix<=0x24800000) { /* x < 2**-54 */ return(-tpi/x); - } + } z = x*x; u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); @@ -235,7 +235,7 @@ ponef(float x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/src/e_jn.c b/lib/libm/src/e_jn.c index 657c4ddee..662fc8209 100644 --- a/lib/libm/src/e_jn.c +++ b/lib/libm/src/e_jn.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -14,7 +14,7 @@ * jn(n, x), yn(n, x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -33,7 +33,7 @@ * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * + * */ #include "math.h" @@ -60,7 +60,7 @@ jn(int n, double x) ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; - if(n<0){ + if(n<0){ n = -n; x = -x; hx ^= 0x80000000; @@ -71,13 +71,13 @@ jn(int n, double x) x = fabs(x); if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ b = zero; - else if((double)n<=x) { + else if((double)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 @@ -94,7 +94,7 @@ jn(int n, double x) case 3: temp = cos(x)-sin(x); break; } b = invsqrtpi*temp/sqrt(x); - } else { + } else { a = j0(x); b = j1(x); for(i=1;i33) /* underflow */ @@ -120,14 +120,14 @@ jn(int n, double x) } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -143,9 +143,9 @@ jn(int n, double x) * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ double t,v; @@ -167,7 +167,7 @@ jn(int n, double x) * single 8.8722839355e+01 * double 7.09782712893383973096e+02 * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is + * then recurrent value may overflow and the result is * likely underflow to zero */ tmp = n; @@ -203,7 +203,7 @@ jn(int n, double x) } double -yn(int n, double x) +yn(int n, double x) { int32_t i,hx,ix,lx; int32_t sign; @@ -224,10 +224,10 @@ yn(int n, double x) if(n==1) return(sign*y1(x)); if(ix==0x7ff00000) return zero; if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 @@ -250,7 +250,7 @@ yn(int n, double x) b = y1(x); /* quit if b is -inf */ GET_HIGH_WORD(high,b); - for(i=1;i0x7f800000) return x+x; - if(n<0){ + if(n<0){ n = -n; x = -x; hx ^= 0x80000000; @@ -47,7 +47,7 @@ jnf(int n, float x) x = fabsf(x); if(ix==0||ix>=0x7f800000) /* if x is 0 or inf */ b = zero; - else if((float)n<=x) { + else if((float)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ a = j0f(x); b = j1f(x); @@ -58,7 +58,7 @@ jnf(int n, float x) } } else { if(ix<0x30800000) { /* x < 2**-29 */ - /* x is tiny, return the first Taylor expansion of J(n,x) + /* x is tiny, return the first Taylor expansion of J(n,x) * J(n,x) = 1/n!*(x/2)^n - ... */ if(n>33) /* underflow */ @@ -73,14 +73,14 @@ jnf(int n, float x) } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -96,9 +96,9 @@ jnf(int n, float x) * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ float t,v; @@ -120,7 +120,7 @@ jnf(int n, float x) * single 8.8722839355e+01 * double 7.09782712893383973096e+02 * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is + * then recurrent value may overflow and the result is * likely underflow to zero */ tmp = n; @@ -156,7 +156,7 @@ jnf(int n, float x) } float -ynf(int n, float x) +ynf(int n, float x) { int32_t i,hx,ix,ib; int32_t sign; @@ -181,7 +181,7 @@ ynf(int n, float x) b = y1f(x); /* quit if b is -inf */ GET_FLOAT_WORD(ib,b); - for(i=1;i= 0x7ff00000) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; @@ -111,14 +111,14 @@ log(double x) if(k==0) return f-R; else {dk=(double)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} } - s = f/(2.0+f); + s = f/(2.0+f); dk = (double)k; z = s*s; i = hx-0x6147a; w = z*z; j = 0x6b851-hx; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); i |= j; R = t2+t1; if(i>0) { diff --git a/lib/libm/src/e_log10.c b/lib/libm/src/e_log10.c index 61300a641..d165bdbc1 100644 --- a/lib/libm/src/e_log10.c +++ b/lib/libm/src/e_log10.c @@ -5,33 +5,33 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* log10(x) * Return the base 10 logarithm of x - * + * * Method : * Let log10_2hi = leading 40 bits of log10(2) and * log10_2lo = log10(2) - log10_2hi, * ivln10 = 1/log(10) rounded. * Then - * n = ilogb(x), + * n = ilogb(x), * if(n<0) n = n+1; * x = scalbn(x,-n); * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) * * Note 1: - * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding * mode must set to Round-to-Nearest. * Note 2: * [1/log(10)] rounded to 53 bits has error .198 ulps; * log10 is monotonic at all binary break points. * * Special cases: - * log10(x) is NaN with signal if x < 0; + * log10(x) is NaN with signal if x < 0; * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; * log10(NaN) is that NaN with no signal; * log10(10**N) = N for N=0,1,...,22. diff --git a/lib/libm/src/e_log10f.c b/lib/libm/src/e_log10f.c index c9e7c0990..86e537c3c 100644 --- a/lib/libm/src/e_log10f.c +++ b/lib/libm/src/e_log10f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/e_log2.c b/lib/libm/src/e_log2.c index 68586466f..72ceeb6fa 100644 --- a/lib/libm/src/e_log2.c +++ b/lib/libm/src/e_log2.c @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -39,12 +39,12 @@ log2(double x) k=0; if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) + if (((hx&0x7fffffff)|lx)==0) return -two54/zero; /* log(+-0)=-inf */ if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); - } + } if (hx >= 0x7ff00000) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; @@ -54,18 +54,18 @@ log2(double x) f = x-1.0; dk = (double)k; if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ - if (f==zero) + if (f==zero) return (dk); R = f*f*(0.5-0.33333333333333333*f); return (dk-(R-f)/ln2); } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; i = hx-0x6147a; w = z*z; j = 0x6b851-hx; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); i |= j; R = t2+t1; if(i>0) { diff --git a/lib/libm/src/e_log2f.c b/lib/libm/src/e_log2f.c index c454775fe..164efde6e 100644 --- a/lib/libm/src/e_log2f.c +++ b/lib/libm/src/e_log2f.c @@ -17,7 +17,7 @@ #include "math_private.h" static const float -ln2 = 0.6931471805599452862268, +ln2 = 0.6931471805599452862268, two25 = 3.355443200e+07, /* 0x4c000000 */ Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ @@ -54,7 +54,7 @@ log2f(float x) dk = (float)k; f = x-(float)1.0; if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ - if (f==zero) + if (f==zero) return (dk); R = f*f*((float)0.5-(float)0.33333333333333333*f); return (dk-(R-f)/ln2); diff --git a/lib/libm/src/e_logf.c b/lib/libm/src/e_logf.c index 02b45c032..58812a417 100644 --- a/lib/libm/src/e_logf.c +++ b/lib/libm/src/e_logf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -40,12 +40,12 @@ logf(float x) k=0; if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) + if ((ix&0x7fffffff)==0) return -two25/zero; /* log(+-0)=-inf */ if (ix<0) return (x-x)/zero; /* log(-#) = NaN */ k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(ix,x); - } + } if (ix >= 0x7f800000) return x+x; k += (ix>>23)-127; ix &= 0x007fffff; @@ -60,14 +60,14 @@ logf(float x) if(k==0) return f-R; else {dk=(float)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} } - s = f/((float)2.0+f); + s = f/((float)2.0+f); dk = (float)k; z = s*s; i = ix-(0x6147a<<3); w = z*z; j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); i |= j; R = t2+t1; if(i>0) { diff --git a/lib/libm/src/e_powf.c b/lib/libm/src/e_powf.c index 970dcdd6a..70491de10 100644 --- a/lib/libm/src/e_powf.c +++ b/lib/libm/src/e_powf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -62,7 +62,7 @@ powf(float x, float y) ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if(iy==0) return one; + if(iy==0) return one; /* x==1: 1**y = 1, even if y is NaN */ if (hx==0x3f800000) return one; @@ -70,7 +70,7 @@ powf(float x, float y) /* +-NaN return x+y */ if(ix > 0x7f800000 || iy > 0x7f800000) - return x+y; + return x+y; /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -78,14 +78,14 @@ powf(float x, float y) * yisint = 2 ... y is an even int */ yisint = 0; - if(hx<0) { + if(hx<0) { if(iy>=0x4b800000) yisint = 2; /* even integer y */ else if(iy>=0x3f800000) { k = (iy>>23)-0x7f; /* exponent */ j = iy>>(23-k); if((j<<(23-k))==iy) yisint = 2-(j&1); - } - } + } + } /* special value of y */ if (iy==0x7f800000) { /* y is +-inf */ @@ -95,14 +95,14 @@ powf(float x, float y) return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ return (hy<0)?-y: zero; - } + } if(iy==0x3f800000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3f000000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrtf(x); + return sqrtf(x); } ax = fabsf(x); @@ -113,12 +113,12 @@ powf(float x, float y) if(hx<0) { if(((ix-0x3f800000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) + } else if(yisint==1) z = -z; /* (x<0)**odd = -(|x|**odd) */ } return z; } - + /* (x<0)**(non-int) is NaN */ if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); @@ -127,7 +127,7 @@ powf(float x, float y) /* over/underflow if x is not close to one */ if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny; if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute + /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-one; /* t has 20 trailing zeros */ w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); @@ -224,7 +224,7 @@ powf(float x, float y) n = ((n&0x007fffff)|0x00800000)>>(23-k); if(j<0) n = -n; p_h -= t; - } + } t = p_l+p_h; GET_FLOAT_WORD(is,t); SET_FLOAT_WORD(t,is&0xfffff000); diff --git a/lib/libm/src/e_rem_pio2.c b/lib/libm/src/e_rem_pio2.c index ffc7f2298..a05953271 100644 --- a/lib/libm/src/e_rem_pio2.c +++ b/lib/libm/src/e_rem_pio2.c @@ -5,14 +5,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* __ieee754_rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] + * + * return the remainder of x rem pi/2 in y[0]+y[1] * use __kernel_rem_pio2() */ @@ -38,7 +38,7 @@ static const int32_t npio2_hw[] = { * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) */ -static const double +static const double zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ @@ -63,7 +63,7 @@ __ieee754_rem_pio2(double x, double *y) if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ {y[0] = x; y[1] = 0; return 0;} if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { + if(hx>0) { z = x - pio2_1; if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ y[0] = z - pio2_1t; @@ -93,27 +93,27 @@ __ieee754_rem_pio2(double x, double *y) fn = (double)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 85 bit */ - if(n<32&&ix!=npio2_hw[n-1]) { + if(n<32&&ix!=npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { u_int32_t high; j = ix>>20; - y[0] = r-w; + y[0] = r-w; GET_HIGH_WORD(high,y[0]); i = j-((high>>20)&0x7ff); if(i>16) { /* 2nd iteration needed, good to 118 */ t = r; - w = fn*pio2_2; + w = fn*pio2_2; r = t-w; - w = fn*pio2_2t-((t-r)-w); + w = fn*pio2_2t-((t-r)-w); y[0] = r-w; GET_HIGH_WORD(high,y[0]); i = j-((high>>20)&0x7ff); if(i>49) { /* 3rd iteration need, 151 bits acc */ t = r; /* will cover all possible cases */ - w = fn*pio2_3; + w = fn*pio2_3; r = t-w; - w = fn*pio2_3t-((t-r)-w); + w = fn*pio2_3t-((t-r)-w); y[0] = r-w; } } @@ -122,7 +122,7 @@ __ieee754_rem_pio2(double x, double *y) if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} else return n; } - /* + /* * all other (large) arguments */ if(ix>=0x7ff00000) { /* x is inf or NaN */ diff --git a/lib/libm/src/e_rem_pio2f.c b/lib/libm/src/e_rem_pio2f.c index f2af8c495..7c541f2a4 100644 --- a/lib/libm/src/e_rem_pio2f.c +++ b/lib/libm/src/e_rem_pio2f.c @@ -8,14 +8,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* __ieee754_rem_pio2f(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] + * + * return the remainder of x rem pi/2 in y[0]+y[1] * use __kernel_rem_pio2f() */ @@ -23,31 +23,31 @@ #include "math_private.h" /* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi */ static const int32_t two_over_pi[] = { 0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, -0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, +0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, 0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, -0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, +0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, 0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, -0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, +0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, 0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, -0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, +0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, 0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, -0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, +0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, 0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, -0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, +0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, 0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, -0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, +0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, 0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, -0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, +0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, 0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, -0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, +0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, 0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, -0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, +0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, 0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, -0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, +0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, }; /* This array is like the one in e_rem_pio2.c, but the numbers are @@ -71,7 +71,7 @@ static const int32_t npio2_hw[] = { * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) */ -static const float +static const float zero = 0.0000000000e+00, /* 0x00000000 */ half = 5.0000000000e-01, /* 0x3f000000 */ two8 = 2.5600000000e+02, /* 0x43800000 */ @@ -95,7 +95,7 @@ __ieee754_rem_pio2f(float x, float *y) if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ {y[0] = x; y[1] = 0; return 0;} if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { + if(hx>0) { z = x - pio2_1; if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ y[0] = z - pio2_1t; @@ -125,27 +125,27 @@ __ieee754_rem_pio2f(float x, float *y) fn = (float)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { + if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { u_int32_t high; j = ix>>23; - y[0] = r-w; + y[0] = r-w; GET_FLOAT_WORD(high,y[0]); i = j-((high>>23)&0xff); if(i>8) { /* 2nd iteration needed, good to 57 */ t = r; - w = fn*pio2_2; + w = fn*pio2_2; r = t-w; - w = fn*pio2_2t-((t-r)-w); + w = fn*pio2_2t-((t-r)-w); y[0] = r-w; GET_FLOAT_WORD(high,y[0]); i = j-((high>>23)&0xff); if(i>25) { /* 3rd iteration need, 74 bits acc */ t = r; /* will cover all possible cases */ - w = fn*pio2_3; + w = fn*pio2_3; r = t-w; - w = fn*pio2_3t-((t-r)-w); + w = fn*pio2_3t-((t-r)-w); y[0] = r-w; } } @@ -154,7 +154,7 @@ __ieee754_rem_pio2f(float x, float *y) if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} else return n; } - /* + /* * all other (large) arguments */ if(ix>=0x7f800000) { /* x is inf or NaN */ diff --git a/lib/libm/src/e_remainder.c b/lib/libm/src/e_remainder.c index fa9310c3f..752602428 100644 --- a/lib/libm/src/e_remainder.c +++ b/lib/libm/src/e_remainder.c @@ -5,17 +5,17 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* remainder(x,p) - * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) + * Return : + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) * integer nearest x/p (in half way case choose the even one). - * Method : + * Method : * Based on fmod() return x-[x/p]chopped*p exactlp. */ diff --git a/lib/libm/src/e_remainderf.c b/lib/libm/src/e_remainderf.c index 27dbc2deb..7edd8c6e0 100644 --- a/lib/libm/src/e_remainderf.c +++ b/lib/libm/src/e_remainderf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/e_scalb.c b/lib/libm/src/e_scalb.c index 52a4fbcf5..c7ae2af20 100644 --- a/lib/libm/src/e_scalb.c +++ b/lib/libm/src/e_scalb.c @@ -5,14 +5,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * scalb(x, fn) is provide for - * passing various standard test suite. One + * passing various standard test suite. One * should use scalbn() instead. */ diff --git a/lib/libm/src/e_scalbf.c b/lib/libm/src/e_scalbf.c index 545330eea..8f449cf31 100644 --- a/lib/libm/src/e_scalbf.c +++ b/lib/libm/src/e_scalbf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/e_sinh.c b/lib/libm/src/e_sinh.c index 1df129dcb..46256e02a 100644 --- a/lib/libm/src/e_sinh.c +++ b/lib/libm/src/e_sinh.c @@ -5,21 +5,21 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* sinh(x) - * Method : + * Method : * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 - * 1. Replace x by |x| (sinh(-x) = -sinh(x)). - * 2. + * 1. Replace x by |x| (sinh(-x) = -sinh(x)). + * 2. * E + E/(E+1) * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) * 2 * - * 22 <= x <= lnovft : sinh(x) := exp(x)/2 + * 22 <= x <= lnovft : sinh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : sinh(x) := x*shuge (overflow) * @@ -37,7 +37,7 @@ static const double one = 1.0, shuge = 1.0e307; double sinh(double x) -{ +{ double t,w,h; int32_t ix,jx; u_int32_t lx; @@ -47,7 +47,7 @@ sinh(double x) ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) return x+x; + if(ix>=0x7ff00000) return x+x; h = 0.5; if (jx<0) h = -h; diff --git a/lib/libm/src/e_sinhf.c b/lib/libm/src/e_sinhf.c index 77211bdd3..2232772f7 100644 --- a/lib/libm/src/e_sinhf.c +++ b/lib/libm/src/e_sinhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -20,7 +20,7 @@ static const float one = 1.0, shuge = 1.0e37; float sinhf(float x) -{ +{ float t,w,h; int32_t ix,jx; @@ -28,7 +28,7 @@ sinhf(float x) ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x+x; + if(ix>=0x7f800000) return x+x; h = 0.5; if (jx<0) h = -h; diff --git a/lib/libm/src/e_sqrt.c b/lib/libm/src/e_sqrt.c index 2ac3a9d64..f58e5dac5 100644 --- a/lib/libm/src/e_sqrt.c +++ b/lib/libm/src/e_sqrt.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -15,10 +15,10 @@ * ------------------------------------------ * | Use the hardware sqrt if you have one | * ------------------------------------------ - * Method: - * Bit by bit method using integer arithmetic. (Slow, but portable) + * Method: + * Bit by bit method using integer arithmetic. (Slow, but portable) * 1. Normalization - * Scale x to y in [1,4) with even powers of 2: + * Scale x to y in [1,4) with even powers of 2: * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then * sqrt(x) = 2^k * sqrt(y) * 2. Bit by bit computation @@ -27,9 +27,9 @@ * i+1 2 * s = 2*q , and y = 2 * ( y - q ). (1) * i i i i - * - * To compute q from q , one checks whether - * i+1 i + * + * To compute q from q , one checks whether + * i+1 i * * -(i+1) 2 * (q + 2 ) <= y. (2) @@ -39,12 +39,12 @@ * i+1 i i+1 i * * With some algebraic manipulation, it is not difficult to see - * that (2) is equivalent to + * that (2) is equivalent to * -(i+1) * s + 2 <= y (3) * i i * - * The advantage of (3) is that s and y can be computed by + * The advantage of (3) is that s and y can be computed by * i i * the following recurrence formula: * if (3) is false @@ -56,10 +56,10 @@ * -i -(i+1) * s = s + 2 , y = y - s - 2 (5) * i+1 i i+1 i i - * - * One may easily use induction to prove (4) and (5). + * + * One may easily use induction to prove (4) and (5). * Note. Since the left hand side of (3) contain only i+2 bits, - * it does not necessary to do a full (53-bit) comparison + * it does not necessary to do a full (53-bit) comparison * in (3). * 3. Final rounding * After generating the 53 bits result, we compute one more bit. @@ -69,7 +69,7 @@ * The rounding mode can be detected by checking whether * huge + tiny is equal to huge, and whether huge - tiny is * equal to huge for some floating point number "huge" and "tiny". - * + * * Special cases: * sqrt(+-0) = +-0 ... exact * sqrt(inf) = inf @@ -91,17 +91,17 @@ double sqrt(double x) { double z; - int32_t sign = (int)0x80000000; + int32_t sign = (int)0x80000000; int32_t ix0,s0,q,m,t,i; u_int32_t r,t1,s1,ix1,q1; EXTRACT_WORDS(ix0,ix1,x); /* take care of Inf and NaN */ - if((ix0&0x7ff00000)==0x7ff00000) { + if((ix0&0x7ff00000)==0x7ff00000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if(ix0<=0) { if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ @@ -135,12 +135,12 @@ sqrt(double x) r = 0x00200000; /* r = moving bit from right to left */ while(r!=0) { - t = s0+r; - if(t<=ix0) { - s0 = t+r; - ix0 -= t; - q += r; - } + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } ix0 += ix0 + ((ix1&sign)>>31); ix1 += ix1; r>>=1; @@ -148,9 +148,9 @@ sqrt(double x) r = sign; while(r!=0) { - t1 = s1+r; + t1 = s1+r; t = s0; - if((tone) { if (q1==(u_int32_t)0xfffffffe) q+=1; - q1+=2; + q1+=2; } else q1 += (q1&1); } @@ -189,18 +189,18 @@ LDBL_MAYBE_CLONE(sqrt); /* Other methods (use floating-point arithmetic) ------------- -(This is a copy of a drafted paper by Prof W. Kahan +(This is a copy of a drafted paper by Prof W. Kahan and K.C. Ng, written in May, 1986) - Two algorithms are given here to implement sqrt(x) + Two algorithms are given here to implement sqrt(x) (IEEE double precision arithmetic) in software. Both supply sqrt(x) correctly rounded. The first algorithm (in Section A) uses newton iterations and involves four divisions. The second one uses reciproot iterations to avoid division, but requires more multiplications. Both algorithms need the ability - to chop results of arithmetic operations instead of round them, + to chop results of arithmetic operations instead of round them, and the INEXACT flag to indicate when an arithmetic operation - is executed exactly with no roundoff error, all part of the + is executed exactly with no roundoff error, all part of the standard (IEEE 754-1985). The ability to perform shift, add, subtract and logical AND operations upon 32-bit words is needed too, though not part of the standard. @@ -210,7 +210,7 @@ A. sqrt(x) by Newton Iteration (1) Initial approximation Let x0 and x1 be the leading and the trailing 32-bit words of - a floating point number x (in IEEE double format) respectively + a floating point number x (in IEEE double format) respectively 1 11 52 ...widths ------------------------------------------------------ @@ -218,7 +218,7 @@ A. sqrt(x) by Newton Iteration ------------------------------------------------------ msb lsb msb lsb ...order - + ------------------------ ------------------------ x0: |s| e | f1 | x1: | f2 | ------------------------ ------------------------ @@ -243,7 +243,7 @@ A. sqrt(x) by Newton Iteration (2) Iterative refinement - Apply Heron's rule three times to y, we have y approximates + Apply Heron's rule three times to y, we have y approximates sqrt(x) to within 1 ulp (Unit in the Last Place): y := (y+x/y)/2 ... almost 17 sig. bits @@ -268,12 +268,12 @@ A. sqrt(x) by Newton Iteration it requires more multiplications and additions. Also x must be scaled in advance to avoid spurious overflow in evaluating the expression 3y*y+x. Hence it is not recommended unless division - is slow. If division is very slow, then one should use the + is slow. If division is very slow, then one should use the reciproot algorithm given in section B. (3) Final adjustment - By twiddling y's last bit it is possible to force y to be + By twiddling y's last bit it is possible to force y to be correctly rounded according to the prevailing rounding mode as follows. Let r and i be copies of the rounding mode and inexact flag before entering the square root program. Also we @@ -304,7 +304,7 @@ A. sqrt(x) by Newton Iteration I := i; ... restore inexact flag R := r; ... restore rounded mode return sqrt(x):=y. - + (4) Special cases Square root of +inf, +-0, or NaN is itself; @@ -323,7 +323,7 @@ B. sqrt(x) by Reciproot Iteration k := 0x5fe80000 - (x0>>1); y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits - Here k is a 32-bit integer and T2[] is an integer array + Here k is a 32-bit integer and T2[] is an integer array containing correction terms. Now magically the floating value of y (y's leading 32-bit word is y0, the value of its trailing word y1 is set to zero) approximates 1/sqrt(x) @@ -344,9 +344,9 @@ B. sqrt(x) by Reciproot Iteration Apply Reciproot iteration three times to y and multiply the result by x to get an approximation z that matches sqrt(x) - to about 1 ulp. To be exact, we will have + to about 1 ulp. To be exact, we will have -1ulp < sqrt(x)-z<1.0625ulp. - + ... set rounding mode to Round-to-nearest y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x) y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x) @@ -355,14 +355,14 @@ B. sqrt(x) by Reciproot Iteration z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x) Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that - (a) the term z*y in the final iteration is always less than 1; + (a) the term z*y in the final iteration is always less than 1; (b) the error in the final result is biased upward so that -1 ulp < sqrt(x) - z < 1.0625 ulp instead of |sqrt(x)-z|<1.03125ulp. (3) Final adjustment - By twiddling y's last bit it is possible to force y to be + By twiddling y's last bit it is possible to force y to be correctly rounded according to the prevailing rounding mode as follows. Let r and i be copies of the rounding mode and inexact flag before entering the square root program. Also we @@ -402,27 +402,27 @@ B. sqrt(x) by Reciproot Iteration I := 1; ... Raise Inexact flag: z is not exact else { j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2 - k := z1 >> 26; ... get z's 25-th and 26-th + k := z1 >> 26; ... get z's 25-th and 26-th fraction bits I := i or (k&j) or ((k&(j+j+1))!=(x1&3)); } R:= r ... restore rounded mode return sqrt(x):=z. - If multiplication is cheaper then the foregoing red tape, the + If multiplication is cheaper then the foregoing red tape, the Inexact flag can be evaluated by I := i; I := (z*z!=x) or I. - Note that z*z can overwrite I; this value must be sensed if it is + Note that z*z can overwrite I; this value must be sensed if it is True. Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be zero. -------------------- - z1: | f2 | + z1: | f2 | -------------------- bit 31 bit 0 @@ -439,6 +439,6 @@ B. sqrt(x) by Reciproot Iteration 11 01 even ------------------------------------------------- - (4) Special cases (see (4) of Section A). - + (4) Special cases (see (4) of Section A). + */ diff --git a/lib/libm/src/e_sqrtf.c b/lib/libm/src/e_sqrtf.c index b46a30036..d3daa95a8 100644 --- a/lib/libm/src/e_sqrtf.c +++ b/lib/libm/src/e_sqrtf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -22,17 +22,17 @@ float sqrtf(float x) { float z; - int32_t sign = (int)0x80000000; + int32_t sign = (int)0x80000000; int32_t ix,s,q,m,t,i; u_int32_t r; GET_FLOAT_WORD(ix,x); /* take care of Inf and NaN */ - if((ix&0x7f800000)==0x7f800000) { + if((ix&0x7f800000)==0x7f800000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if(ix<=0) { if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ @@ -57,12 +57,12 @@ sqrtf(float x) r = 0x01000000; /* r = moving bit from right to left */ while(r!=0) { - t = s+r; - if(t<=ix) { - s = t+r; - ix -= t; - q += r; - } + t = s+r; + if(t<=ix) { + s = t+r; + ix -= t; + q += r; + } ix += ix; r>>=1; } diff --git a/lib/libm/src/k_cos.c b/lib/libm/src/k_cos.c index 0839243e9..3db15753d 100644 --- a/lib/libm/src/k_cos.c +++ b/lib/libm/src/k_cos.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -14,7 +14,7 @@ * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. + * Input y is the tail of x. * * Algorithm * 1. Since cos(-x) = cos(x), we need only to consider positive x. @@ -24,15 +24,15 @@ * 4 14 * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x * where the Remes error is - * + * * | 2 4 6 8 10 12 14 | -58 * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 - * | | - * - * 4 6 8 10 12 14 + * | | + * + * 4 6 8 10 12 14 * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then * cos(x) = 1 - x*x/2 + r - * since cos(x+y) ~ cos(x) - sin(x)*y + * since cos(x+y) ~ cos(x) - sin(x)*y * ~ cos(x) - x*y, * a correction term is necessary in cos(x) and hence * cos(x+y) = 1 - (x*x/2 - (r - x*y)) @@ -52,7 +52,7 @@ #include "math.h" #include "math_private.h" -static const double +static const double one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ diff --git a/lib/libm/src/k_cosf.c b/lib/libm/src/k_cosf.c index e6f571296..fd49e2227 100644 --- a/lib/libm/src/k_cosf.c +++ b/lib/libm/src/k_cosf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0000000000e+00, /* 0x3f800000 */ C1 = 4.1666667908e-02, /* 0x3d2aaaab */ C2 = -1.3888889225e-03, /* 0xbab60b61 */ @@ -34,7 +34,7 @@ __kernel_cosf(float x, float y) ix &= 0x7fffffff; /* ix = |x|'s high word*/ z = x*x; r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3e99999a) /* if |x| < 0.3 */ + if(ix < 0x3e99999a) /* if |x| < 0.3 */ return one - ((float)0.5*z - (z*r - x*y)); else { if(ix > 0x3f480000) { /* x > 0.78125 */ diff --git a/lib/libm/src/k_rem_pio2.c b/lib/libm/src/k_rem_pio2.c index 972c1264f..b256e4742 100644 --- a/lib/libm/src/k_rem_pio2.c +++ b/lib/libm/src/k_rem_pio2.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -13,12 +13,12 @@ /* * __kernel_rem_pio2(x,y,e0,nx,prec) * double x[],y[]; int e0,nx,prec; - * - * __kernel_rem_pio2 return the last three digits of N with + * + * __kernel_rem_pio2 return the last three digits of N with * y = x - N*pi/2 * so that |y| < pi/2. * - * The method is to compute the integer (mod 8) and fraction parts of + * The method is to compute the integer (mod 8) and fraction parts of * (2/pi)*x without doing the full multiplication. In general we * skip the part of the product that are known to be a huge integer ( * more accurately, = 0 mod 8 ). Thus the number of operations are @@ -27,10 +27,10 @@ * (2/pi) is represented by an array of 24-bit integers in ipio2[]. * * Input parameters: - * x[] The input value (must be positive) is broken into nx + * x[] The input value (must be positive) is broken into nx * pieces of 24-bit integers in double precision format. - * x[i] will be the i-th 24 bit of x. The scaled exponent - * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 * match x's up to 24 bits. * * Example of breaking a double positive z into x[0]+x[1]+x[2]: @@ -77,8 +77,8 @@ * in the computation. The recommended value is 2,3,4, * 6 for single, double, extended,and quad. * - * jz local integer variable indicating the number of - * terms of ipio2[] used. + * jz local integer variable indicating the number of + * terms of ipio2[] used. * * jx nx - 1 * @@ -98,9 +98,9 @@ * exponent for q[i] would be q0-24*i. * * PIo2[] double precision array, obtained by cutting pi/2 - * into 24 bits chunks. + * into 24 bits chunks. * - * f[] ipio2[] in floating point + * f[] ipio2[] in floating point * * iq[] integer array by breaking up q[] in 24-bits chunk. * @@ -114,9 +114,9 @@ /* * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -130,8 +130,8 @@ static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ /* * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi * - * integer array, contains the (24*i)-th to (24*i+23)-th - * bit of 2/pi after binary point. The corresponding + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding * floating value is * * ipio2[i] * 2^(-24(i+1)). @@ -140,17 +140,17 @@ static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ * For quad precision (e0 <= 16360, jk = 6), this is 686. */ static const int32_t ipio2[] = { -0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, -0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, -0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, -0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, -0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, -0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, -0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, -0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, -0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, -0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, -0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, #if LDBL_MAX_EXP > 1024 #if LDBL_MAX_EXP > 16384 @@ -275,7 +275,7 @@ static const double PIo2[] = { 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ }; -static const double +static const double zero = 0.0, one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ @@ -324,7 +324,7 @@ recompute: i = (iq[jz-1]>>(24-q0)); n += i; iq[jz-1] -= i<<(24-q0); ih = iq[jz-1]>>(23-q0); - } + } else if(q0==0) ih = iq[jz-1]>>23; else if(z>=0.5) ih=2; @@ -375,7 +375,7 @@ recompute: while(iq[jz]==0) { jz--; q0-=24;} } else { /* break z into 24-bit if necessary */ z = scalbn(z,-q0); - if(z>=two24) { + if(z>=two24) { fw = (double)((int32_t)(twon24*z)); iq[jz] = (int32_t)(z-two24*fw); jz += 1; q0 += 24; @@ -400,30 +400,30 @@ recompute: case 0: fw = 0.0; for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + y[0] = (ih==0)? fw: -fw; break; case 1: case 2: fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; + for (i=jz;i>=0;i--) fw += fq[i]; STRICT_ASSIGN(double,fw,fw); - y[0] = (ih==0)? fw: -fw; + y[0] = (ih==0)? fw: -fw; fw = fq[0]-fw; for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; + y[1] = (ih==0)? fw: -fw; break; case 3: /* painful */ for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; if(ih==0) { y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; } else { diff --git a/lib/libm/src/k_rem_pio2f.c b/lib/libm/src/k_rem_pio2f.c index 5931cbab9..25c3166a8 100644 --- a/lib/libm/src/k_rem_pio2f.c +++ b/lib/libm/src/k_rem_pio2f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -35,7 +35,7 @@ static const float PIo2[] = { 6.3331015649e-25, /* 0x17440000 */ }; -static const float +static const float zero = 0.0, one = 1.0, two8 = 2.5600000000e+02, /* 0x43800000 */ @@ -43,7 +43,7 @@ twon8 = 3.9062500000e-03; /* 0x3b800000 */ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, - const int32_t *ipio2) + const int32_t *ipio2) { int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; float z,fw,f[20],fq[20],q[20]; @@ -85,7 +85,7 @@ recompute: i = (iq[jz-1]>>(8-q0)); n += i; iq[jz-1] -= i<<(8-q0); ih = iq[jz-1]>>(7-q0); - } + } else if(q0==0) ih = iq[jz-1]>>8; else if(z>=(float)0.5) ih=2; @@ -136,7 +136,7 @@ recompute: while(iq[jz]==0) { jz--; q0-=8;} } else { /* break z into 8-bit if necessary */ z = scalbnf(z,-q0); - if(z>=two8) { + if(z>=two8) { fw = (float)((int32_t)(twon8*z)); iq[jz] = (int32_t)(z-two8*fw); jz += 1; q0 += 8; @@ -161,29 +161,29 @@ recompute: case 0: fw = 0.0; for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + y[0] = (ih==0)? fw: -fw; break; case 1: case 2: fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; fw = fq[0]-fw; for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; + y[1] = (ih==0)? fw: -fw; break; case 3: /* painful */ for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; if(ih==0) { y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; } else { diff --git a/lib/libm/src/k_sin.c b/lib/libm/src/k_sin.c index a560f7380..18426b944 100644 --- a/lib/libm/src/k_sin.c +++ b/lib/libm/src/k_sin.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -14,24 +14,24 @@ * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. * Input y is the tail of x. - * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). + * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). * * Algorithm - * 1. Since sin(-x) = -sin(x), we need only to consider positive x. + * 1. Since sin(-x) = -sin(x), we need only to consider positive x. * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. * 3. sin(x) is approximated by a polynomial of degree 13 on * [0,pi/4] * 3 13 * sin(x) ~ x + S1*x + ... + S6*x * where - * + * * |sin(x) 2 4 6 8 10 12 | -58 * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 - * | x | - * + * | x | + * * 4. sin(x+y) = sin(x) + sin'(x')*y * ~ sin(x) + (1-x*x/2)*y - * For better accuracy, let + * For better accuracy, let * 3 2 2 2 2 * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) * then 3 2 @@ -41,7 +41,7 @@ #include "math.h" #include "math_private.h" -static const double +static const double half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ diff --git a/lib/libm/src/k_sincos.h b/lib/libm/src/k_sincos.h index 796e72af8..15e812f87 100644 --- a/lib/libm/src/k_sincos.h +++ b/lib/libm/src/k_sincos.h @@ -4,10 +4,10 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== - * + * * k_sin.c and k_cos.c merged by Steven G. Kargl. */ diff --git a/lib/libm/src/k_sinf.c b/lib/libm/src/k_sinf.c index a0cf75355..d678aeec1 100644 --- a/lib/libm/src/k_sinf.c +++ b/lib/libm/src/k_sinf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float half = 5.0000000000e-01,/* 0x3f000000 */ S1 = -1.6666667163e-01, /* 0xbe2aaaab */ S2 = 8.3333337680e-03, /* 0x3c088889 */ diff --git a/lib/libm/src/k_tanf.c b/lib/libm/src/k_tanf.c index 8327713a9..fdc65ff3d 100644 --- a/lib/libm/src/k_tanf.c +++ b/lib/libm/src/k_tanf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,7 +16,7 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0000000000e+00, /* 0x3f800000 */ pio4 = 7.8539812565e-01, /* 0x3f490fda */ pio4lo= 3.7748947079e-08, /* 0x33222168 */ @@ -72,7 +72,7 @@ __kernel_tanf(float x, float y, int iy) return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); } if(iy==1) return w; - else { /* if allow error up to 2 ulp, + else { /* if allow error up to 2 ulp, simply return -1.0/(x+r) here */ /* compute -1.0/(x+r) accurately */ float a,t; diff --git a/lib/libm/src/ld128/e_fmodl.c b/lib/libm/src/ld128/e_fmodl.c index cb629ddd7..a8f7e5cfb 100644 --- a/lib/libm/src/ld128/e_fmodl.c +++ b/lib/libm/src/ld128/e_fmodl.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -104,7 +104,7 @@ fmodl(long double x, long double y) /* convert back to floating value and restore the sign */ if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int64_t)sx>>63]; + return Zero[(u_int64_t)sx>>63]; while(hx<0x0001000000000000LL) { /* normalize x */ hx = hx+hx+(lx>>63); lx = lx+lx; iy -= 1; diff --git a/lib/libm/src/ld128/invtrig.c b/lib/libm/src/ld128/invtrig.c index 15db44a18..f972c5a0e 100644 --- a/lib/libm/src/ld128/invtrig.c +++ b/lib/libm/src/ld128/invtrig.c @@ -56,8 +56,8 @@ qS9 = -1.99407384882605586705979504567947007e-04L; */ const long double atanhi[] = { 4.63647609000806116214256231461214397e-01L, - 7.85398163397448309615660845819875699e-01L, - 9.82793723247329067985710611014666038e-01L, + 7.85398163397448309615660845819875699e-01L, + 9.82793723247329067985710611014666038e-01L, 1.57079632679489661923132169163975140e+00L, }; diff --git a/lib/libm/src/ld128/k_cosl.c b/lib/libm/src/ld128/k_cosl.c index 70966786a..0dd9029a3 100644 --- a/lib/libm/src/ld128/k_cosl.c +++ b/lib/libm/src/ld128/k_cosl.c @@ -7,7 +7,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/ld128/k_sincosl.h b/lib/libm/src/ld128/k_sincosl.h index 55247bbd1..d09a43ad9 100644 --- a/lib/libm/src/ld128/k_sincosl.h +++ b/lib/libm/src/ld128/k_sincosl.h @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * @@ -40,7 +40,7 @@ S11 = -0.38680813379701966970673724299207480965452616911420e-22, S12 = 0.64038150078671872796678569586315881020659912139412e-25; static inline void -__kernel_sincosl(long double x, long double y, int iy, long double *sn, +__kernel_sincosl(long double x, long double y, int iy, long double *sn, long double *cs) { long double hz, r, v, w, z; @@ -61,7 +61,7 @@ __kernel_sincosl(long double x, long double y, int iy, long double *sn, hz = z / 2; w = 1 - hz; - r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * (C6 + + r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * (C6 + z * (C7 + z * (C8 + z * (C9 + z * (C10 + z * C11)))))))))); *cs = w + (((1 - w) - hz) + (z * r - x * y)); diff --git a/lib/libm/src/ld128/k_sinl.c b/lib/libm/src/ld128/k_sinl.c index 15a6cedc2..d474a1d82 100644 --- a/lib/libm/src/ld128/k_sinl.c +++ b/lib/libm/src/ld128/k_sinl.c @@ -7,7 +7,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/ld128/s_ilogbl.c b/lib/libm/src/ld128/s_ilogbl.c index 879778e2f..3ff73d7cd 100644 --- a/lib/libm/src/ld128/s_ilogbl.c +++ b/lib/libm/src/ld128/s_ilogbl.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -34,7 +34,7 @@ ilogbl(long double x) GET_LDOUBLE_WORDS64(hx,lx,x); hx &= 0x7fffffffffffffffLL; if(hx<0x0001000000000000LL) { - if((hx|lx)==0) + if((hx|lx)==0) return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ else /* subnormal x */ if(hx==0) { diff --git a/lib/libm/src/ld128/s_remquol.c b/lib/libm/src/ld128/s_remquol.c index b779489e0..4d8521a78 100644 --- a/lib/libm/src/ld128/s_remquol.c +++ b/lib/libm/src/ld128/s_remquol.c @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/ld80/k_sincosl.h b/lib/libm/src/ld80/k_sincosl.h index 89c48419b..fbb880a7c 100644 --- a/lib/libm/src/ld80/k_sincosl.h +++ b/lib/libm/src/ld80/k_sincosl.h @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * diff --git a/lib/libm/src/ld80/s_ilogbl.c b/lib/libm/src/ld80/s_ilogbl.c index dba170220..fdf9c4fd4 100644 --- a/lib/libm/src/ld80/s_ilogbl.c +++ b/lib/libm/src/ld80/s_ilogbl.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -33,7 +33,7 @@ ilogbl(long double x) GET_LDOUBLE_WORDS(esx,hx,lx,x); esx &= 0x7fff; if(esx==0) { - if((hx|lx)==0) + if((hx|lx)==0) return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ else /* subnormal x */ if(hx==0) { diff --git a/lib/libm/src/math_private.h b/lib/libm/src/math_private.h index dbd4df269..a198e52c7 100644 --- a/lib/libm/src/math_private.h +++ b/lib/libm/src/math_private.h @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_asinh.c b/lib/libm/src/s_asinh.c index 769f9d0bd..c09a9f2f0 100644 --- a/lib/libm/src/s_asinh.c +++ b/lib/libm/src/s_asinh.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* asinh(x) * Method : - * Based on + * Based on * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] * we have * asinh(x) := x if 1+x*x=1, * := sign(x)*(log(x)+ln2)) for large |x|, else * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) */ #include @@ -26,14 +26,14 @@ #include "math_private.h" -static const double +static const double one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ -huge= 1.00000000000000000000e+300; +huge= 1.00000000000000000000e+300; double asinh(double x) -{ +{ double t,w; int32_t hx,ix; GET_HIGH_WORD(hx,x); @@ -41,7 +41,7 @@ asinh(double x) if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ if(ix< 0x3e300000) { /* |x|<2**-28 */ if(huge+x>one) return x; /* return x inexact except 0 */ - } + } if(ix>0x41b00000) { /* |x| > 2**28 */ w = log(fabs(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ diff --git a/lib/libm/src/s_asinhf.c b/lib/libm/src/s_asinhf.c index 4ee14f6ea..4e622d5f6 100644 --- a/lib/libm/src/s_asinhf.c +++ b/lib/libm/src/s_asinhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -16,14 +16,14 @@ #include "math.h" #include "math_private.h" -static const float +static const float one = 1.0000000000e+00, /* 0x3F800000 */ ln2 = 6.9314718246e-01, /* 0x3f317218 */ -huge= 1.0000000000e+30; +huge= 1.0000000000e+30; float asinhf(float x) -{ +{ float t,w; int32_t hx,ix; GET_FLOAT_WORD(hx,x); @@ -31,7 +31,7 @@ asinhf(float x) if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ if(ix< 0x31800000) { /* |x|<2**-28 */ if(huge+x>one) return x; /* return x inexact except 0 */ - } + } if(ix>0x4d800000) { /* |x| > 2**28 */ w = logf(fabsf(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ diff --git a/lib/libm/src/s_atan.c b/lib/libm/src/s_atan.c index 3a56b95d3..82b81d019 100644 --- a/lib/libm/src/s_atan.c +++ b/lib/libm/src/s_atan.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -24,9 +24,9 @@ * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -63,7 +63,7 @@ static const double aT[] = { 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ }; -static const double +static const double one = 1.0, huge = 1.0e300; @@ -93,9 +93,9 @@ atan(double x) x = fabs(x); if (ix < 0x3ff30000) { /* |x| < 1.1875 */ if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = (2.0*x-one)/(2.0+x); + id = 0; x = (2.0*x-one)/(2.0+x); } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); + id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x40038000) { /* |x| < 2.4375 */ diff --git a/lib/libm/src/s_atanf.c b/lib/libm/src/s_atanf.c index 97541fb53..a85f8631d 100644 --- a/lib/libm/src/s_atanf.c +++ b/lib/libm/src/s_atanf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -44,7 +44,7 @@ static const float aT[] = { 1.6285819933e-02, /* 0x3c8569d7 */ }; -static const float +static const float one = 1.0, huge = 1.0e30; @@ -71,9 +71,9 @@ atanf(float x) x = fabsf(x); if (ix < 0x3f980000) { /* |x| < 1.1875 */ if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = ((float)2.0*x-one)/((float)2.0+x); + id = 0; x = ((float)2.0*x-one)/((float)2.0+x); } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); + id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x401c0000) { /* |x| < 2.4375 */ diff --git a/lib/libm/src/s_cbrt.c b/lib/libm/src/s_cbrt.c index 8ea4003ad..efa2fb512 100644 --- a/lib/libm/src/s_cbrt.c +++ b/lib/libm/src/s_cbrt.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -30,7 +30,7 @@ F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ double -cbrt(double x) +cbrt(double x) { int32_t hx; double r,s,t=0.0,w; @@ -42,7 +42,7 @@ cbrt(double x) hx ^=sign; if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ GET_LOW_WORD(low,x); - if((hx|low)==0) + if((hx|low)==0) return(x); /* cbrt(0) is itself */ SET_HIGH_WORD(x,hx); /* x <- |x| */ @@ -58,9 +58,9 @@ cbrt(double x) /* new cbrt to 23 bits, may be implemented in single precision */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); - /* chopped to 20 bits and make it larger than cbrt(x) */ + /* chopped to 20 bits and make it larger than cbrt(x) */ GET_HIGH_WORD(high,t); INSERT_WORDS(t,high+0x00000001,0); diff --git a/lib/libm/src/s_cbrtf.c b/lib/libm/src/s_cbrtf.c index 44829b0c0..68ef2467e 100644 --- a/lib/libm/src/s_cbrtf.c +++ b/lib/libm/src/s_cbrtf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -19,7 +19,7 @@ /* cbrtf(x) * Return cube root of x */ -static const unsigned +static const unsigned B1 = 709958130, /* B1 = (84+2/3-0.03306235651)*2**23 */ B2 = 642849266; /* B2 = (76+2/3-0.03306235651)*2**23 */ @@ -31,7 +31,7 @@ F = 1.6071428061e+00, /* 45/28 = 0x3fcdb6db */ G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */ float -cbrtf(float x) +cbrtf(float x) { float r,s,t; int32_t hx; @@ -42,7 +42,7 @@ cbrtf(float x) sign=hx&0x80000000; /* sign= sign(x) */ hx ^=sign; if(hx>=0x7f800000) return(x+x); /* cbrt(NaN,INF) is itself */ - if(hx==0) + if(hx==0) return(x); /* cbrt(0) is itself */ SET_FLOAT_WORD(x,hx); /* x <- |x| */ @@ -58,7 +58,7 @@ cbrtf(float x) /* new cbrt to 23 bits */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); /* restore the sign bit */ GET_FLOAT_WORD(high,t); diff --git a/lib/libm/src/s_ceil.c b/lib/libm/src/s_ceil.c index df22b5068..a4855a59b 100644 --- a/lib/libm/src/s_ceil.c +++ b/lib/libm/src/s_ceil.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -36,7 +36,7 @@ ceil(double x) if(jj0<20) { if(jj0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;i1=0;} + if(i0<0) {i0=0x80000000;i1=0;} else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} } } else { @@ -55,7 +55,7 @@ ceil(double x) if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0>0) { - if(jj0==20) i0+=1; + if(jj0==20) i0+=1; else { j = i1 + (1<<(52-jj0)); if(j(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;} + if(i0<0) {i0=0x80000000;} else if(i0!=0) { i0=0x3f800000;} } } else { diff --git a/lib/libm/src/s_clog.c b/lib/libm/src/s_clog.c index e3e9d04c7..ee9cf5551 100644 --- a/lib/libm/src/s_clog.c +++ b/lib/libm/src/s_clog.c @@ -38,7 +38,7 @@ * If z = x + iy, r = sqrt( x**2 + y**2 ), * then * w = log(r) + i arctan(y/x). - * + * * The arctangent ranges from -PI to +PI. * * diff --git a/lib/libm/src/s_copysign.c b/lib/libm/src/s_copysign.c index c499d55ce..570583d23 100644 --- a/lib/libm/src/s_copysign.c +++ b/lib/libm/src/s_copysign.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_copysignf.c b/lib/libm/src/s_copysignf.c index 553e7daf9..62ead7113 100644 --- a/lib/libm/src/s_copysignf.c +++ b/lib/libm/src/s_copysignf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_cos.c b/lib/libm/src/s_cos.c index 1406504e9..aeb678bee 100644 --- a/lib/libm/src/s_cos.c +++ b/lib/libm/src/s_cos.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -19,8 +19,8 @@ * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -38,7 +38,7 @@ * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include diff --git a/lib/libm/src/s_cosf.c b/lib/libm/src/s_cosf.c index 5c3b56140..d6c2a188c 100644 --- a/lib/libm/src/s_cosf.c +++ b/lib/libm/src/s_cosf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_cosl.c b/lib/libm/src/s_cosl.c index 867cc6ee9..6b3ab800e 100644 --- a/lib/libm/src/s_cosl.c +++ b/lib/libm/src/s_cosl.c @@ -83,7 +83,7 @@ cosl(long double x) xd[i] = (double)((int32_t)z.e); z.e = (z.e - xd[i]) * two24; } - + /* yd contains the pieces of xd rem pi/2 such that |yd| < pi/4. */ e0 = __kernel_rem_pio2(xd, yd, e0, NX, PREC); @@ -111,7 +111,7 @@ cosl(long double x) hi = __kernel_sinl(hi, lo, 1); break; } - + return (hi); } DEF_STD(cosl); diff --git a/lib/libm/src/s_erf.c b/lib/libm/src/s_erf.c index 30e183f8f..7771e3e29 100644 --- a/lib/libm/src/s_erf.c +++ b/lib/libm/src/s_erf.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -15,11 +15,11 @@ * x * 2 |\ * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| + * sqrt(pi) \| * 0 * * erfc(x) = 1-erf(x) - * Note that + * Note that * erf(-x) = -erf(x) * erfc(-x) = 2 - erfc(x) * @@ -32,7 +32,7 @@ * Q is an odd poly of degree 10. * -57.90 * | R - (erf(x)-x)/x | <= 2 - * + * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) @@ -55,14 +55,14 @@ * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where + * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * - * 3. For x in [1.25,1/0.35(~2.857143)], + * 3. For x in [1.25,1/0.35(~2.857143)], * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) * erf(x) = 1 - erfc(x) - * where + * where * R1(z) = degree 7 poly in z, (z=1/x^2) * S1(z) = degree 8 poly in z * @@ -80,7 +80,7 @@ * To compute exp(-x*x-0.5625+R/S), let s be a single * precision number and s := x; then * -x*x = -s*s + (s-x)*(s+x) - * exp(-x*x-0.5626+R/S) = + * exp(-x*x-0.5626+R/S) = * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S); * Note2: * Here 4 and 5 make use of the asymptotic series @@ -100,7 +100,7 @@ * * 7. Special case: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ @@ -132,7 +132,7 @@ qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ @@ -185,7 +185,7 @@ sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ double -erf(double x) +erf(double x) { int32_t hx,ix,i; double R,S,P,Q,s,y,z,r; @@ -198,7 +198,7 @@ erf(double x) if(ix < 0x3feb0000) { /* |x|<0.84375 */ if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) + if (ix < 0x00800000) return 0.125*(8.0*x+efx8*x); /*avoid underflow */ return x + efx*x; } @@ -230,7 +230,7 @@ erf(double x) S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( sb5+s*(sb6+s*sb7)))))); } - z = x; + z = x; SET_LOW_WORD(z,0); r = exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S); if(hx>=0) return one-r/x; else return r/x-one; @@ -239,7 +239,7 @@ DEF_STD(erf); LDBL_MAYBE_CLONE(erf); double -erfc(double x) +erfc(double x) { int32_t hx,ix; double R,S,P,Q,s,y,z,r; @@ -270,7 +270,7 @@ erfc(double x) P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) { - z = one-erx; return z - P/Q; + z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } diff --git a/lib/libm/src/s_erff.c b/lib/libm/src/s_erff.c index f94e2d8e0..59d70ca40 100644 --- a/lib/libm/src/s_erff.c +++ b/lib/libm/src/s_erff.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -39,7 +39,7 @@ qq3 = 5.0813062117e-03, /* 0x3ba68116 */ qq4 = 1.3249473704e-04, /* 0x390aee49 */ qq5 = -3.9602282413e-06, /* 0xb684e21a */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ pa1 = 4.1485610604e-01, /* 0x3ed46805 */ @@ -92,7 +92,7 @@ sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ sb7 = -2.2440952301e+01; /* 0xc1b38712 */ float -erff(float x) +erff(float x) { int32_t hx,ix,i; float R,S,P,Q,s,y,z,r; @@ -105,7 +105,7 @@ erff(float x) if(ix < 0x3f580000) { /* |x|<0.84375 */ if(ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) + if (ix < 0x04000000) /*avoid underflow */ return (float)0.125*((float)8.0*x+efx8*x); return x + efx*x; @@ -145,7 +145,7 @@ erff(float x) } float -erfcf(float x) +erfcf(float x) { int32_t hx,ix; float R,S,P,Q,s,y,z,r; @@ -176,7 +176,7 @@ erfcf(float x) P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) { - z = one-erx; return z - P/Q; + z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } diff --git a/lib/libm/src/s_exp2.c b/lib/libm/src/s_exp2.c index 0f8d66ffb..b22306ebd 100644 --- a/lib/libm/src/s_exp2.c +++ b/lib/libm/src/s_exp2.c @@ -350,7 +350,7 @@ exp2(double x) GET_LOW_WORD(lx,x); if(((ix & 0xfffff) | lx) != 0 || (hx & 0x80000000) == 0) return (x + x); /* x is NaN or +Inf */ - else + else return (0.0); /* x is -Inf */ } if(x >= 0x1.0p10) diff --git a/lib/libm/src/s_exp2f.c b/lib/libm/src/s_exp2f.c index 6319b11c1..effb7b6ac 100644 --- a/lib/libm/src/s_exp2f.c +++ b/lib/libm/src/s_exp2f.c @@ -61,7 +61,7 @@ static const double exp2ft[TBLSIZE] = { 0x1.4bfdad5362a27p+0, 0x1.5ab07dd485429p+0, }; - + /* * exp2f(x): compute the base 2 exponential of x * @@ -103,7 +103,7 @@ exp2f(float x) if(ix >= 0x7f800000) { if ((ix & 0x7fffff) != 0 || (hx & 0x80000000) == 0) return (x + x); /* x is NaN or +Inf */ - else + else return (0.0); /* x is -Inf */ } if(x >= 0x1.0p7f) diff --git a/lib/libm/src/s_expm1.c b/lib/libm/src/s_expm1.c index ec6b416f7..25893f5f9 100644 --- a/lib/libm/src/s_expm1.c +++ b/lib/libm/src/s_expm1.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -17,9 +17,9 @@ * 1. Argument reduction: * Given x, find r and integer k such that * - * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 + * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 * - * Here a correction term c will be computed to compensate + * Here a correction term c will be computed to compensate * the error in r when rounded to a floating-point number. * * 2. Approximating expm1(r) by a special rational function on @@ -32,9 +32,9 @@ * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... - * We use a special Remes algorithm on [0,0.347] to generate - * a polynomial of degree 5 in r*r to approximate R1. The - * maximum error of this polynomial approximation is bounded + * We use a special Remes algorithm on [0,0.347] to generate + * a polynomial of degree 5 in r*r to approximate R1. The + * maximum error of this polynomial approximation is bounded * by 2**-61. In other words, * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 * where Q1 = -1.6666666666666567384E-2, @@ -45,28 +45,28 @@ * (where z=r*r, and the values of Q1 to Q5 are listed below) * with error bounded by * | 5 | -61 - * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 + * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 * | | - * - * expm1(r) = exp(r)-1 is then computed by the following - * specific way which minimize the accumulation rounding error: + * + * expm1(r) = exp(r)-1 is then computed by the following + * specific way which minimize the accumulation rounding error: * 2 3 * r r [ 3 - (R1 + R1*r/2) ] * expm1(r) = r + --- + --- * [--------------------] * 2 2 [ 6 - r*(3 - R1*r/2) ] - * + * * To compensate the error in the argument reduction, we use - * expm1(r+c) = expm1(r) + c + expm1(r)*c - * ~ expm1(r) + c + r*c + * expm1(r+c) = expm1(r) + c + expm1(r)*c + * ~ expm1(r) + c + r*c * Thus c+r*c will be added in as the correction terms for - * expm1(r+c). Now rearrange the term to avoid optimization + * expm1(r+c). Now rearrange the term to avoid optimization * screw up: * ( 2 2 ) * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) * ( ) - * + * * = r - E * 3. Scale back to obtain expm1(x): * From step 1, we have @@ -83,7 +83,7 @@ * else return 1.0+2.0*(r-E); * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else - * (vii) return 2^k(1-((E+2^-k)-r)) + * (vii) return 2^k(1-((E+2^-k)-r)) * * Special cases: * expm1(INF) is INF, expm1(NaN) is NaN; @@ -95,12 +95,12 @@ * 1 ulp (unit in the last place). * * Misc. info. - * For IEEE double + * For IEEE double * if x > 7.09782712893383973096e+02 then expm1(x) overflow * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -143,7 +143,7 @@ expm1(double x) if(hx>=0x7ff00000) { u_int32_t low; GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) + if(((hx&0xfffff)|low)!=0) return x+x; /* NaN */ else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ } @@ -156,7 +156,7 @@ expm1(double x) } /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ if(xsb==0) {hi = x - ln2_hi; lo = ln2_lo; k = 1;} @@ -170,10 +170,10 @@ expm1(double x) } x = hi - lo; c = (hi-x)-lo; - } + } else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); + return x - (t-(huge+x)); } else k = 0; diff --git a/lib/libm/src/s_expm1f.c b/lib/libm/src/s_expm1f.c index 7b7e7c72c..03b677593 100644 --- a/lib/libm/src/s_expm1f.c +++ b/lib/libm/src/s_expm1f.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -59,7 +59,7 @@ expm1f(float x) } /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ if(xsb==0) {hi = x - ln2_hi; lo = ln2_lo; k = 1;} @@ -73,10 +73,10 @@ expm1f(float x) } x = hi - lo; c = (hi-x)-lo; - } + } else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); + return x - (t-(huge+x)); } else k = 0; diff --git a/lib/libm/src/s_fabsf.c b/lib/libm/src/s_fabsf.c index e3b96a712..2aa3e4fcc 100644 --- a/lib/libm/src/s_fabsf.c +++ b/lib/libm/src/s_fabsf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_floor.c b/lib/libm/src/s_floor.c index 1d7d0f77a..7fe0b40e6 100644 --- a/lib/libm/src/s_floor.c +++ b/lib/libm/src/s_floor.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -36,7 +36,7 @@ floor(double x) if(jj0<20) { if(jj0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} + if(i0>=0) {i0=i1=0;} else if(((i0&0x7fffffff)|i1)!=0) { i0=0xbff00000;i1=0;} } @@ -56,7 +56,7 @@ floor(double x) if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0<0) { - if(jj0==20) i0+=1; + if(jj0==20) i0+=1; else { j = i1+(1<<(52-jj0)); if(j(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} + if(i0>=0) {i0=0;} else if((i0&0x7fffffff)!=0) { i0=0xbf800000;} } diff --git a/lib/libm/src/s_frexpf.c b/lib/libm/src/s_frexpf.c index 74cf5f3d9..bca27b514 100644 --- a/lib/libm/src/s_frexpf.c +++ b/lib/libm/src/s_frexpf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_ilogb.c b/lib/libm/src/s_ilogb.c index bfa627eb7..bfc245f25 100644 --- a/lib/libm/src/s_ilogb.c +++ b/lib/libm/src/s_ilogb.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -31,7 +31,7 @@ ilogb(double x) hx &= 0x7fffffff; if(hx<0x00100000) { GET_LOW_WORD(lx,x); - if((hx|lx)==0) + if((hx|lx)==0) return FP_ILOGB0; /* ilogb(0) = FP_ILOGB0 */ else /* subnormal x */ if(hx==0) { diff --git a/lib/libm/src/s_ilogbf.c b/lib/libm/src/s_ilogbf.c index 5f2816382..a2b0b26ee 100644 --- a/lib/libm/src/s_ilogbf.c +++ b/lib/libm/src/s_ilogbf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -24,7 +24,7 @@ ilogbf(float x) GET_FLOAT_WORD(hx,x); hx &= 0x7fffffff; if(hx<0x00800000) { - if(hx==0) + if(hx==0) return FP_ILOGB0; /* ilogb(0) = FP_ILOGB */ else /* subnormal x */ for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; diff --git a/lib/libm/src/s_log1p.c b/lib/libm/src/s_log1p.c index 20fcfeefd..318b96fb1 100644 --- a/lib/libm/src/s_log1p.c +++ b/lib/libm/src/s_log1p.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* double log1p(double x) * - * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), + * Method : + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), * where sqrt(2)/2 < 1+f < sqrt(2) . * * Note. If k=0, then f=x is exact. However, if k!=0, then f @@ -28,8 +28,8 @@ * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., * = 2s + s*R - * We use a special Remes algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error + * We use a special Remes algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error * of this polynomial approximation is bounded by 2**-58.45. In * other words, * 2 4 6 8 10 12 14 @@ -37,21 +37,21 @@ * (the values of Lp1 to Lp7 are listed in the program) * and * | 2 14 | -58.45 - * | Lp1*s +...+Lp7*s - R(z) | <= 2 + * | Lp1*s +...+Lp7*s - R(z) | <= 2 * | | * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. * In order to guarantee error in log below 1ulp, we compute log * by * log1p(f) = f - (hfsq - s*(hfsq+R)). - * - * 3. Finally, log1p(x) = k*ln2 + log1p(f). + * + * 3. Finally, log1p(x) = k*ln2 + log1p(f). * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: + * Here ln2 is split into two floating point number: * ln2_hi + ln2_lo, * where n*ln2_hi is always exact for |n| < 2000. * * Special cases: - * log1p(x) is NaN with signal if x < -1 (including -INF) ; + * log1p(x) is NaN with signal if x < -1 (including -INF) ; * log1p(+INF) is +INF; log1p(-1) is -INF with signal; * log1p(NaN) is that NaN with no signal. * @@ -60,14 +60,14 @@ * 1 ulp (unit in the last place). * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. * * Note: Assuming log() return accurate answer, the following * algorithm can be used to compute log1p(x) to within a few ULP: - * + * * u = 1+x; * if(u==1.0) return x ; else * return log(u)*(x/(u-1.0)); @@ -118,11 +118,11 @@ log1p(double x) } if(hx>0||hx<=((int32_t)0xbfd2bec3)) { k=0;f=x;hu=1;} /* -0.2929= 0x7ff00000) return x+x; if(k!=0) { if(hx<0x43400000) { - u = 1.0+x; + u = 1.0+x; GET_HIGH_WORD(hu,u); k = (hu>>20)-1023; c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ @@ -137,7 +137,7 @@ log1p(double x) if(hu<0x6a09e) { SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ } else { - k += 1; + k += 1; SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ hu = (0x00100000-hu)>>2; } @@ -145,13 +145,13 @@ log1p(double x) } hfsq=0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; + if(f==zero) if(k==0) return zero; else {c += k*ln2_lo; return k*ln2_hi+c;} R = hfsq*(1.0-0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); if(k==0) return f-(hfsq-s*(hfsq+R)); else diff --git a/lib/libm/src/s_log1pf.c b/lib/libm/src/s_log1pf.c index 897a0109b..84dac9801 100644 --- a/lib/libm/src/s_log1pf.c +++ b/lib/libm/src/s_log1pf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -54,11 +54,11 @@ log1pf(float x) } if(hx>0||hx<=((int32_t)0xbe95f61f)) { k=0;f=x;hu=1;} /* -0.2929= 0x7f800000) return x+x; if(k!=0) { if(hx<0x5a000000) { - u = (float)1.0+x; + u = (float)1.0+x; GET_FLOAT_WORD(hu,u); k = (hu>>23)-127; /* correction term */ @@ -74,7 +74,7 @@ log1pf(float x) if(hu<0x3504f7) { SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */ } else { - k += 1; + k += 1; SET_FLOAT_WORD(u,hu|0x3f000000); /* normalize u/2 */ hu = (0x00800000-hu)>>2; } @@ -82,13 +82,13 @@ log1pf(float x) } hfsq=(float)0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; + if(f==zero) if(k==0) return zero; else {c += k*ln2_lo; return k*ln2_hi+c;} R = hfsq*((float)1.0-(float)0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/((float)2.0+f); + s = f/((float)2.0+f); z = s*s; R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); if(k==0) return f-(hfsq-s*(hfsq+R)); else diff --git a/lib/libm/src/s_logb.c b/lib/libm/src/s_logb.c index 277b41c6d..309e5ae24 100644 --- a/lib/libm/src/s_logb.c +++ b/lib/libm/src/s_logb.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -28,9 +28,9 @@ logb(double x) if((ix|lx)==0) return -1.0/fabs(x); if(ix>=0x7ff00000) return x*x; if((ix>>=20)==0) /* IEEE 754 logb */ - return -1022.0; + return -1022.0; else - return (double) (ix-1023); + return (double) (ix-1023); } DEF_STD(logb); LDBL_MAYBE_UNUSED_CLONE(logb); diff --git a/lib/libm/src/s_logbf.c b/lib/libm/src/s_logbf.c index 30737b976..52c019206 100644 --- a/lib/libm/src/s_logbf.c +++ b/lib/libm/src/s_logbf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -25,8 +25,8 @@ logbf(float x) if(ix==0) return (float)-1.0/fabsf(x); if(ix>=0x7f800000) return x*x; if((ix>>=23)==0) /* IEEE 754 logb */ - return -126.0; + return -126.0; else - return (float) (ix-127); + return (float) (ix-127); } DEF_STD(logbf); diff --git a/lib/libm/src/s_modff.c b/lib/libm/src/s_modff.c index 2a014dea8..1d8356e63 100644 --- a/lib/libm/src/s_modff.c +++ b/lib/libm/src/s_modff.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_nextafter.c b/lib/libm/src/s_nextafter.c index ba7d0ea1e..9f96ab847 100644 --- a/lib/libm/src/s_nextafter.c +++ b/lib/libm/src/s_nextafter.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -35,7 +35,7 @@ nextafter(double x, double y) if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ - return x+y; + return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ diff --git a/lib/libm/src/s_nextafterf.c b/lib/libm/src/s_nextafterf.c index c2bb36c41..072ccf03a 100644 --- a/lib/libm/src/s_nextafterf.c +++ b/lib/libm/src/s_nextafterf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -26,15 +26,15 @@ nextafterf(float x, float y) ix = hx&0x7fffffff; /* |x| */ iy = hy&0x7fffffff; /* |y| */ - if((ix>0x7f800000) || /* x is nan */ - (iy>0x7f800000)) /* y is nan */ - return x+y; + if((ix>0x7f800000) || /* x is nan */ + (iy>0x7f800000)) /* y is nan */ + return x+y; if(x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ y = x*x; if(y==x) return y; else return x; /* raise underflow flag */ - } + } if(hx>=0) { /* x > 0 */ if(hx>hy) { /* x > y, x -= ulp */ hx -= 1; diff --git a/lib/libm/src/s_remquo.c b/lib/libm/src/s_remquo.c index 5eeb47a8f..44361b916 100644 --- a/lib/libm/src/s_remquo.c +++ b/lib/libm/src/s_remquo.c @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -72,7 +72,7 @@ remquo(double x, double y, int *quo) } else iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) + if(ix >= -1022) hx = 0x00100000|(0x000fffff&hx); else { /* subnormal x, shift x to normal */ n = -1022-ix; @@ -84,7 +84,7 @@ remquo(double x, double y, int *quo) lx = 0; } } - if(iy >= -1022) + if(iy >= -1022) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; diff --git a/lib/libm/src/s_remquof.c b/lib/libm/src/s_remquof.c index cf9fdfbe2..e04a84b9c 100644 --- a/lib/libm/src/s_remquof.c +++ b/lib/libm/src/s_remquof.c @@ -5,7 +5,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_rint.c b/lib/libm/src/s_rint.c index 975d8a081..c747e8443 100644 --- a/lib/libm/src/s_rint.c +++ b/lib/libm/src/s_rint.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -42,7 +42,7 @@ rint(double x) sx = (i0>>31)&1; jj0 = ((i0>>20)&0x7ff)-0x3ff; if(jj0<20) { - if(jj0<0) { + if(jj0<0) { if(((i0&0x7fffffff)|i1)==0) return x; i1 |= (i0&0x0fffff); i0 &= 0xfffe0000; diff --git a/lib/libm/src/s_rintf.c b/lib/libm/src/s_rintf.c index eda6ea1c5..a9137444f 100644 --- a/lib/libm/src/s_rintf.c +++ b/lib/libm/src/s_rintf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -33,7 +33,7 @@ rintf(float x) sx = (i0>>31)&1; jj0 = ((i0>>23)&0xff)-0x7f; if(jj0<23) { - if(jj0<0) { + if(jj0<0) { if((i0&0x7fffffff)==0) return x; i1 = (i0&0x07fffff); i0 &= 0xfff00000; diff --git a/lib/libm/src/s_scalbn.c b/lib/libm/src/s_scalbn.c index 7ca54bfc0..d259c7e5f 100644 --- a/lib/libm/src/s_scalbn.c +++ b/lib/libm/src/s_scalbn.c @@ -5,15 +5,15 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an + * scalbn(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an * exponentiation or a multiplication. */ diff --git a/lib/libm/src/s_scalbnf.c b/lib/libm/src/s_scalbnf.c index a3363033d..4fd67aa77 100644 --- a/lib/libm/src/s_scalbnf.c +++ b/lib/libm/src/s_scalbnf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -32,11 +32,11 @@ scalbnf(float x, int n) if ((ix&0x7fffffff)==0) return x; /* +-0 */ x *= two25; GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; + k = ((ix&0x7f800000)>>23) - 25; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0xff) return x+x; /* NaN or Inf */ - k = k+n; + k = k+n; if (k > 0xfe) return huge*copysignf(huge,x); /* overflow */ if (k > 0) /* normal result */ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} diff --git a/lib/libm/src/s_significand.c b/lib/libm/src/s_significand.c index 055ff5df2..7bbe6d1a4 100644 --- a/lib/libm/src/s_significand.c +++ b/lib/libm/src/s_significand.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_significandf.c b/lib/libm/src/s_significandf.c index e90be9e58..3cdaa4daa 100644 --- a/lib/libm/src/s_significandf.c +++ b/lib/libm/src/s_significandf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_sin.c b/lib/libm/src/s_sin.c index c99fd8947..be50edcdc 100644 --- a/lib/libm/src/s_sin.c +++ b/lib/libm/src/s_sin.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -19,8 +19,8 @@ * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -38,7 +38,7 @@ * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include diff --git a/lib/libm/src/s_sincos.c b/lib/libm/src/s_sincos.c index 2ab1a86c1..672801ff1 100644 --- a/lib/libm/src/s_sincos.c +++ b/lib/libm/src/s_sincos.c @@ -7,7 +7,7 @@ * software is freely granted, provided that this notice * is preserved. * ==================================================== - * + * * s_sin.c and s_cos.c merged by Steven G. Kargl. Descriptions of the * algorithms are contained in the original files. */ diff --git a/lib/libm/src/s_sinf.c b/lib/libm/src/s_sinf.c index 2e9e416b2..6e3901ca8 100644 --- a/lib/libm/src/s_sinf.c +++ b/lib/libm/src/s_sinf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_sinl.c b/lib/libm/src/s_sinl.c index a4303d170..467898e61 100644 --- a/lib/libm/src/s_sinl.c +++ b/lib/libm/src/s_sinl.c @@ -112,7 +112,7 @@ sinl(long double x) hi = - __kernel_cosl(hi, lo); break; } - + return (s ? -hi : hi); } DEF_STD(sinl); diff --git a/lib/libm/src/s_tan.c b/lib/libm/src/s_tan.c index afa0520ae..06b12d099 100644 --- a/lib/libm/src/s_tan.c +++ b/lib/libm/src/s_tan.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -18,8 +18,8 @@ * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -37,7 +37,7 @@ * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include diff --git a/lib/libm/src/s_tanf.c b/lib/libm/src/s_tanf.c index a79f73fa7..370c066a1 100644 --- a/lib/libm/src/s_tanf.c +++ b/lib/libm/src/s_tanf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/s_tanh.c b/lib/libm/src/s_tanh.c index f01bd0d68..85aa990f9 100644 --- a/lib/libm/src/s_tanh.c +++ b/lib/libm/src/s_tanh.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -52,7 +52,7 @@ tanh(double x) ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) { + if(ix>=0x7ff00000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } diff --git a/lib/libm/src/s_tanhf.c b/lib/libm/src/s_tanhf.c index 946e059cf..6972b0e4d 100644 --- a/lib/libm/src/s_tanhf.c +++ b/lib/libm/src/s_tanhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -28,7 +28,7 @@ tanhf(float x) ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) { + if(ix>=0x7f800000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } diff --git a/lib/libm/src/s_tanl.c b/lib/libm/src/s_tanl.c index c71e8d5c7..a65e81d4d 100644 --- a/lib/libm/src/s_tanl.c +++ b/lib/libm/src/s_tanl.c @@ -87,7 +87,7 @@ tanl(long double x) xd[i] = (double)((int32_t)z.e); z.e = (z.e - xd[i]) * two24; } - + /* yd contains the pieces of xd rem pi/2 such that |yd| < pi/4. */ e0 = __kernel_rem_pio2(xd, yd, e0, NX, PREC); diff --git a/lib/libm/src/w_drem.c b/lib/libm/src/w_drem.c index 5038f5c40..74008a5c8 100644 --- a/lib/libm/src/w_drem.c +++ b/lib/libm/src/w_drem.c @@ -1,6 +1,6 @@ /* * drem() wrapper for remainder(). - * + * * Written by J.T. Conklin, * Placed into the Public Domain, 1994. */ diff --git a/lib/libm/src/w_dremf.c b/lib/libm/src/w_dremf.c index e6404b393..18df07801 100644 --- a/lib/libm/src/w_dremf.c +++ b/lib/libm/src/w_dremf.c @@ -1,6 +1,6 @@ /* * dremf() wrapper for remainderf(). - * + * * Written by J.T. Conklin, * Placed into the Public Domain, 1994. */ diff --git a/lib/libm/src/w_gamma.c b/lib/libm/src/w_gamma.c index 624198c7e..0e1b7d6ca 100644 --- a/lib/libm/src/w_gamma.c +++ b/lib/libm/src/w_gamma.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -25,4 +25,4 @@ double gamma(double x) { return lgamma_r(x,&signgam); -} +} diff --git a/lib/libm/src/w_gamma_r.c b/lib/libm/src/w_gamma_r.c index cccb9cc28..7967512f0 100644 --- a/lib/libm/src/w_gamma_r.c +++ b/lib/libm/src/w_gamma_r.c @@ -5,12 +5,12 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * wrapper double gamma_r(double x, int *signgamp) */ @@ -21,4 +21,4 @@ double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */ { return lgamma_r(x,signgamp); -} +} diff --git a/lib/libm/src/w_gammaf.c b/lib/libm/src/w_gammaf.c index 6b27e6c4a..e031468e3 100644 --- a/lib/libm/src/w_gammaf.c +++ b/lib/libm/src/w_gammaf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/w_gammaf_r.c b/lib/libm/src/w_gammaf_r.c index 88e3af8b9..fedd6c2ca 100644 --- a/lib/libm/src/w_gammaf_r.c +++ b/lib/libm/src/w_gammaf_r.c @@ -8,12 +8,12 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * wrapper float gammaf_r(float x, int *signgamp) */ diff --git a/lib/libm/src/w_lgamma.c b/lib/libm/src/w_lgamma.c index bc8b3f6d1..ce3e3274f 100644 --- a/lib/libm/src/w_lgamma.c +++ b/lib/libm/src/w_lgamma.c @@ -5,7 +5,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libm/src/w_lgammaf.c b/lib/libm/src/w_lgammaf.c index 662ced457..70f0cf1f3 100644 --- a/lib/libm/src/w_lgammaf.c +++ b/lib/libm/src/w_lgammaf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ diff --git a/lib/libossaudio/ossaudio.c b/lib/libossaudio/ossaudio.c index bad73ac0c..e6c7186d2 100644 --- a/lib/libossaudio/ossaudio.c +++ b/lib/libossaudio/ossaudio.c @@ -123,7 +123,7 @@ mixer_ondesc(void *unused, struct sioctl_desc *d, int val) * hw/output.level that we map to OSS gain controls. This * ensures useful knobs are exposed no matter if sndiod * is running or not. - */ + */ if (d->group[0] == 0) { if (strcmp(d->node0.name, "output") == 0) type = SOUND_MIXER_VOLUME; @@ -143,7 +143,7 @@ mixer_ondesc(void *unused, struct sioctl_desc *d, int val) i = malloc(sizeof(struct control)); if (i == NULL) { - DPRINTF("%s: cannot allocate control\n", __func__); + DPRINTF("%s: cannot allocate control\n", __func__); return; } diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index e5f5d3342..0be96bbac 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1627,7 +1627,7 @@ iphl_to_x(void) /* A = A + X (add off_nl again to compensate) */ sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X)); - + /* MEM[iphl_reg] = A */ iphl_reg = alloc_reg(); tmp = new_stmt(BPF_ST); @@ -3403,7 +3403,7 @@ gen_mpls(label) if (mpls_stack > 0) /* Bottom-Of-Label-Stack bit ? */ b0 = gen_mcmp(off_nl-2, BPF_B, (bpf_int32)0, 0x1); - else + else b0 = gen_linktype(ETHERTYPE_MPLS); if (label >= 0) { diff --git a/lib/libpcap/gencode.h b/lib/libpcap/gencode.h index 81a886fd6..50c48ef27 100644 --- a/lib/libpcap/gencode.h +++ b/lib/libpcap/gencode.h @@ -87,7 +87,7 @@ struct slist { struct slist *next; }; -/* +/* * A bit vector to represent definition sets. We assume TOT_REGISTERS * is smaller than 8*sizeof(atomset). */ diff --git a/lib/libpcap/inet.c b/lib/libpcap/inet.c index 2e4db700d..75ebdad84 100644 --- a/lib/libpcap/inet.c +++ b/lib/libpcap/inet.c @@ -211,7 +211,7 @@ pcap_lookupdev(errbuf) } /* Must be up and not the loopback */ - if ((ifr.ifr_flags & IFF_UP) == 0 || + if ((ifr.ifr_flags & IFF_UP) == 0 || ISLOOPBACK(ifr.ifr_name, ifr.ifr_flags)) continue; diff --git a/lib/libpcap/nametoaddr.c b/lib/libpcap/nametoaddr.c index e7d0c79a1..b9a5df603 100644 --- a/lib/libpcap/nametoaddr.c +++ b/lib/libpcap/nametoaddr.c @@ -353,7 +353,7 @@ pcap_ether_hostton(const char *name) return (NULL); else rewind(fp); - + while ((ep = pcap_next_etherent(fp)) != NULL) { if (strcmp(ep->name, name) == 0) { ap = malloc(6); diff --git a/lib/libpcap/optimize.c b/lib/libpcap/optimize.c index 9b3eceff3..713da0053 100644 --- a/lib/libpcap/optimize.c +++ b/lib/libpcap/optimize.c @@ -1140,7 +1140,7 @@ opt_blk(b, do_stmts) * already there, or if this block is a return, * eliminate all the statements. */ - if (do_stmts && + if (do_stmts && ((b->out_use == 0 && aval != 0 &&b->val[A_ATOM] == aval) || BPF_CLASS(b->s.code) == BPF_RET)) { if (b->stmts != 0) { @@ -1865,7 +1865,7 @@ fail2: free(space1); bpf_error("malloc"); } - + p = space1; all_dom_sets = p; for (i = 0; i < n; ++i) { @@ -2100,14 +2100,14 @@ icode_to_fcode(root, lenp) while (1) { unMarkAll(); n = *lenp = count_stmts(root); - + fp = calloc(n, sizeof(*fp)); if (fp == NULL) bpf_error("calloc"); fstart = fp; ftail = fp + n; - + unMarkAll(); if (convert_code_r(root)) break; diff --git a/lib/libpcap/pcap-int.h b/lib/libpcap/pcap-int.h index eeb088602..abef8c16a 100644 --- a/lib/libpcap/pcap-int.h +++ b/lib/libpcap/pcap-int.h @@ -103,7 +103,7 @@ struct pcap { */ u_char *pkt; - + /* * Placeholder for filter code if bpf not in kernel. */ diff --git a/lib/libpcap/pcap.c b/lib/libpcap/pcap.c index 508d30498..c077d0c1e 100644 --- a/lib/libpcap/pcap.c +++ b/lib/libpcap/pcap.c @@ -126,7 +126,7 @@ pcap_fakecallback(u_char *userData, const struct pcap_pkthdr *h, *sp->pkt = pkt; } -int +int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, const u_char **pkt_data) { @@ -293,7 +293,7 @@ pcap_list_datalinks(pcap_t *p, int **dlt_buffer) * the C runtime library, which means that the library might use one * version of malloc() and free() and the application might use another * version of malloc() and free(). If so, that means something - * allocated by the library cannot be freed by the application, so we + * allocated by the library cannot be freed by the application, so we * need to have a pcap_free_datalinks() routine to free up the list * allocated by pcap_list_datalinks(), even though it's just a wrapper * around free(). diff --git a/lib/libpcap/savefile.c b/lib/libpcap/savefile.c index 3209e663e..7a7ee873b 100644 --- a/lib/libpcap/savefile.c +++ b/lib/libpcap/savefile.c @@ -452,7 +452,7 @@ pcap_dump_open(pcap_t *p, const char *fname) */ pcap_dumper_t * pcap_dump_fopen(pcap_t *p, FILE *f) -{ +{ return (pcap_setup_dump(p, f, "stream")); } diff --git a/lib/libpcap/scanner.l b/lib/libpcap/scanner.l index ffae10e19..b9d029477 100644 --- a/lib/libpcap/scanner.l +++ b/lib/libpcap/scanner.l @@ -36,7 +36,7 @@ #include #ifdef INET6 -#include +#include #include #endif /*INET6*/ diff --git a/lib/libradius/radius_eapmsk.c b/lib/libradius/radius_eapmsk.c index 95fe0f775..a06831a39 100644 --- a/lib/libradius/radius_eapmsk.c +++ b/lib/libradius/radius_eapmsk.c @@ -33,7 +33,7 @@ #include "radius_local.h" -int +int radius_get_eap_msk(const RADIUS_PACKET * packet, void *buf, size_t * len, const char *secret) { diff --git a/lib/librthread/rthread.c b/lib/librthread/rthread.c index 53f1d9ca8..0a4c31449 100644 --- a/lib/librthread/rthread.c +++ b/lib/librthread/rthread.c @@ -399,7 +399,7 @@ pthread_create(pthread_t *threadp, const pthread_attr_t *attr, *threadp = thread; return (0); } - + rc = errno; _spinlock(&_thread_lock); diff --git a/lib/librthread/rthread_attr.c b/lib/librthread/rthread_attr.c index 461972e56..e9c28611d 100644 --- a/lib/librthread/rthread_attr.c +++ b/lib/librthread/rthread_attr.c @@ -180,7 +180,7 @@ int pthread_attr_getstacksize(const pthread_attr_t *attrp, size_t *stacksize) { *stacksize = (*attrp)->stack_size; - + return (0); } diff --git a/lib/librthread/rthread_mutexattr.c b/lib/librthread/rthread_mutexattr.c index 7565b4f77..e7679b169 100644 --- a/lib/librthread/rthread_mutexattr.c +++ b/lib/librthread/rthread_mutexattr.c @@ -88,7 +88,7 @@ pthread_mutexattr_getprotocol(pthread_mutexattr_t *attrp, int *protocol) int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attrp, int prioceiling) { - if (prioceiling < PTHREAD_MIN_PRIORITY || + if (prioceiling < PTHREAD_MIN_PRIORITY || prioceiling > PTHREAD_MAX_PRIORITY) return (EINVAL); (*attrp)->ma_prioceiling = prioceiling; diff --git a/lib/librthread/rthread_np.c b/lib/librthread/rthread_np.c index b2d10e1ce..20c4cdfcf 100644 --- a/lib/librthread/rthread_np.c +++ b/lib/librthread/rthread_np.c @@ -74,7 +74,7 @@ pthread_main_np(void) * it's the bottom. You'll have to ask Sun what they were thinking... * * This function taken from the uthread library, with the following - * license: + * license: * PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman */ int pthread_stackseg_np(pthread_t thread, stack_t *sinfo) diff --git a/lib/librthread/rthread_rwlockattr.c b/lib/librthread/rthread_rwlockattr.c index 90209f1ee..602755b52 100644 --- a/lib/librthread/rthread_rwlockattr.c +++ b/lib/librthread/rthread_rwlockattr.c @@ -56,7 +56,7 @@ pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attrp, int *pshared) { *pshared = (*attrp)->pshared; - return (0); + return (0); } int @@ -64,7 +64,7 @@ pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attrp, int pshared) { /* only PTHREAD_PROCESS_PRIVATE is supported */ if (pshared != PTHREAD_PROCESS_PRIVATE) - return (EINVAL); + return (EINVAL); (*attrp)->pshared = pshared; diff --git a/lib/libssl/LICENSE b/lib/libssl/LICENSE index 892e14a45..fd4afda26 100644 --- a/lib/libssl/LICENSE +++ b/lib/libssl/LICENSE @@ -1,7 +1,7 @@ LibReSSL files are retained under the copyright of the authors. New additions are ISC licensed as per OpenBSD's normal licensing policy, - or are placed in the public domain. + or are placed in the public domain. The OpenSSL code is distributed under the terms of the original OpenSSL licenses which follow: @@ -25,7 +25,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -80,21 +80,21 @@ * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. - * + * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * + * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -109,10 +109,10 @@ * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from + * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * + * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -124,7 +124,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence diff --git a/lib/libssl/bytestring.h b/lib/libssl/bytestring.h index 51284da8d..2aede1300 100644 --- a/lib/libssl/bytestring.h +++ b/lib/libssl/bytestring.h @@ -559,6 +559,6 @@ int cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag, int CBS_asn1_indefinite_to_definite(CBS *in, uint8_t **out, size_t *out_len); #endif /* LIBRESSL_INTERNAL */ -__END_HIDDEN_DECLS +__END_HIDDEN_DECLS #endif /* OPENSSL_HEADER_BYTESTRING_H */ diff --git a/lib/libssl/pqueue.h b/lib/libssl/pqueue.h index cdda4a396..6db8ad3b9 100644 --- a/lib/libssl/pqueue.h +++ b/lib/libssl/pqueue.h @@ -61,7 +61,7 @@ #ifndef HEADER_PQUEUE_H #define HEADER_PQUEUE_H -__BEGIN_HIDDEN_DECLS +__BEGIN_HIDDEN_DECLS typedef struct _pqueue *pqueue; @@ -88,6 +88,6 @@ pitem *pqueue_next(piterator *iter); int pqueue_size(pqueue pq); -__END_HIDDEN_DECLS +__END_HIDDEN_DECLS #endif /* ! HEADER_PQUEUE_H */ diff --git a/lib/libssl/ssl_clnt.c b/lib/libssl/ssl_clnt.c index 76ed10f80..6813081f8 100644 --- a/lib/libssl/ssl_clnt.c +++ b/lib/libssl/ssl_clnt.c @@ -1778,7 +1778,7 @@ ssl3_get_server_done(SSL *s) int ret; if ((ret = ssl3_get_message(s, SSL3_ST_CR_SRVR_DONE_A, - SSL3_ST_CR_SRVR_DONE_B, SSL3_MT_SERVER_DONE, + SSL3_ST_CR_SRVR_DONE_B, SSL3_MT_SERVER_DONE, 30 /* should be very small, like 0 :-) */)) <= 0) return ret; diff --git a/lib/libssl/test/cms-test.pl b/lib/libssl/test/cms-test.pl index dfef799be..6d311f7e2 100644 --- a/lib/libssl/test/cms-test.pl +++ b/lib/libssl/test/cms-test.pl @@ -383,11 +383,11 @@ sub run_smime_tests { my ( $tnam, $rscmd, $rvcmd ) = @$smtst; if ($ossl8) { - # Skip smime resign: 0.9.8 smime doesn't support -resign + # Skip smime resign: 0.9.8 smime doesn't support -resign next if ($scmd =~ /smime/ && $rscmd =~ /-resign/); # Disable streaming: option not supported in 0.9.8 - $tnam =~ s/streaming//; - $rscmd =~ s/-stream//; + $tnam =~ s/streaming//; + $rscmd =~ s/-stream//; $rvcmd =~ s/-stream//; } system("$scmd$rscmd$redir"); diff --git a/lib/libssl/test/pkits-test.pl b/lib/libssl/test/pkits-test.pl index f10da008c..44dcee43c 100644 --- a/lib/libssl/test/pkits-test.pl +++ b/lib/libssl/test/pkits-test.pl @@ -50,7 +50,7 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. # ==================================================================== -# Perl utility to run PKITS tests for RFC3280 compliance. +# Perl utility to run PKITS tests for RFC3280 compliance. my $ossl_path; diff --git a/lib/libssl/test/test.cnf b/lib/libssl/test/test.cnf index 10834442a..50ffe5f20 100644 --- a/lib/libssl/test/test.cnf +++ b/lib/libssl/test/test.cnf @@ -74,7 +74,7 @@ localityName = Locality Name (eg, city) localityName_value = Brisbane organizationName = Organization Name (eg, company) -organizationName_default = +organizationName_default = organizationName_value = CryptSoft Pty Ltd organizationalUnitName = Organizational Unit Name (eg, section) diff --git a/lib/libssl/test/test_aesni b/lib/libssl/test/test_aesni index e8fb63ee2..1f26f2ba3 100644 --- a/lib/libssl/test/test_aesni +++ b/lib/libssl/test/test_aesni @@ -38,7 +38,7 @@ if $PROG engine aesni | grep -v no-aesni; then nerr=`expr $nerr + 1` fi done - for bufsize in $BUFSIZE; do + for bufsize in $BUFSIZE; do TEST=`( cat $PROG | \ $PROG enc -e -k "$HASH" -$alg | \ $PROG enc -d -k "$HASH" -$alg -bufsize $bufsize -engine aesni | \ diff --git a/lib/libssl/test/testtsa b/lib/libssl/test/testtsa index bb653b5f7..0a4d4644c 100644 --- a/lib/libssl/test/testtsa +++ b/lib/libssl/test/testtsa @@ -44,7 +44,7 @@ create_ca () { echo "Creating a new CA for the TSA tests..." TSDNSECT=ts_ca_dn - export TSDNSECT + export TSDNSECT ../../util/shlib_wrap.sh ../../apps/openssl req -new -x509 -nodes \ -out tsaca.pem -keyout tsacakey.pem test $? != 0 && error @@ -56,7 +56,7 @@ create_tsa_cert () { export INDEX EXT=$2 TSDNSECT=ts_cert_dn - export TSDNSECT + export TSDNSECT ../../util/shlib_wrap.sh ../../apps/openssl req -new \ -out tsa_req${INDEX}.pem -keyout tsa_key${INDEX}.pem diff --git a/lib/libssl/test/times b/lib/libssl/test/times index 6b66eb342..2f8175b59 100644 --- a/lib/libssl/test/times +++ b/lib/libssl/test/times @@ -91,7 +91,7 @@ The general cipher performance number for this platform are SSLeay 0.8.2a 04-Sep-1997 built on Fri Sep 5 17:37:05 EST 1997 options:bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) idea(int) blowfish(ptr2) -C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized +C flags:gcc -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized The 'numbers' are in 1000s of bytes per second processed. type 8 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes md2 131.02k 368.41k 500.57k 549.21k 566.09k diff --git a/lib/libusbhid/parse.c b/lib/libusbhid/parse.c index faebdcfd3..dfc77879b 100644 --- a/lib/libusbhid/parse.c +++ b/lib/libusbhid/parse.c @@ -240,7 +240,7 @@ hid_get_item_raw(hid_data_t s, hid_item_t *h) dval = s->usage_last; } s->icount ++; - /* + /* * Only copy HID item, increment position and return * if correct kindset! */ diff --git a/lib/libutil/ber.c b/lib/libutil/ber.c index c21f2d8da..ef030ad1e 100644 --- a/lib/libutil/ber.c +++ b/lib/libutil/ber.c @@ -594,7 +594,7 @@ ober_printf_elements(struct ber_element *ber, char *fmt, ...) memset(parent, 0, sizeof(struct ber_element *) * _MAX_SEQ); va_start(ap, fmt); - + while (*fmt) { switch (*fmt++) { case 'B': diff --git a/lib/libutil/ohash.h b/lib/libutil/ohash.h index c5f81ec0e..731206651 100644 --- a/lib/libutil/ohash.h +++ b/lib/libutil/ohash.h @@ -18,7 +18,7 @@ #ifndef OHASH_H #define OHASH_H -/* Open hashing support. +/* Open hashing support. * Open hashing was chosen because it is much lighter than other hash * techniques, and more efficient in most cases. */ diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index e9be61c0b..53e27e272 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.23 2023/07/07 10:23:39 patrick Exp $ */ +/* $OpenBSD: virtio.c,v 1.24 2023/12/02 10:01:35 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -97,7 +97,7 @@ virtio_log_features(uint64_t host, uint64_t neg, const struct virtio_feature_name *namep; int i; char c; - uint32_t bit; + uint64_t bit; for (i = 0; i < 64; i++) { if (i == 30) { @@ -107,13 +107,17 @@ virtio_log_features(uint64_t host, uint64_t neg, */ continue; } - bit = 1 << i; + bit = 1ULL << i; if ((host&bit) == 0) continue; - namep = (i < 24 || i > 37) ? guest_feature_names : - transport_feature_names; + namep = guest_feature_names; while (namep->bit && namep->bit != bit) namep++; + if (namep->name == NULL) { + namep = transport_feature_names; + while (namep->bit && namep->bit != bit) + namep++; + } c = (neg&bit) ? '+' : '-'; if (namep->name) printf(" %c%s", c, namep->name); diff --git a/sys/dev/pv/virtiovar.h b/sys/dev/pv/virtiovar.h index 7f2aea701..d12cb2c59 100644 --- a/sys/dev/pv/virtiovar.h +++ b/sys/dev/pv/virtiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtiovar.h,v 1.15 2023/07/07 10:23:39 patrick Exp $ */ +/* $OpenBSD: virtiovar.h,v 1.16 2023/12/02 10:01:35 sf Exp $ */ /* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -138,7 +138,7 @@ struct virtqueue { }; struct virtio_feature_name { - uint32_t bit; + uint64_t bit; const char *name; }; @@ -203,7 +203,7 @@ struct virtio_softc { #define virtio_device_reset(sc) virtio_set_status((sc), 0) static inline int -virtio_has_feature(struct virtio_softc *sc, unsigned int fbit) +virtio_has_feature(struct virtio_softc *sc, uint64_t fbit) { if (sc->sc_active_features & fbit) return 1; diff --git a/sys/net/pipex.c b/sys/net/pipex.c index ea2d206f7..bfca3d945 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.150 2023/11/28 13:23:20 bluhm Exp $ */ +/* $OpenBSD: pipex.c,v 1.151 2023/12/01 20:30:22 mvs Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -716,7 +716,8 @@ pipex_lookup_by_session_id(int protocol, int session_id) void pipex_timer_start(void) { - timeout_set_proc(&pipex_timer_ch, pipex_timer, NULL); + timeout_set_flags(&pipex_timer_ch, pipex_timer, NULL, + KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE); timeout_add_sec(&pipex_timer_ch, pipex_prune); } @@ -731,8 +732,6 @@ pipex_timer(void *ignored_arg) { struct pipex_session *session, *session_tmp; - timeout_add_sec(&pipex_timer_ch, pipex_prune); - mtx_enter(&pipex_list_mtx); /* walk through */ LIST_FOREACH_SAFE(session, &pipex_session_list, session_list, @@ -767,6 +766,9 @@ pipex_timer(void *ignored_arg) } } + if (LIST_FIRST(&pipex_session_list)) + timeout_add_sec(&pipex_timer_ch, pipex_prune); + mtx_leave(&pipex_list_mtx); }