]>
git.proxmox.com Git - rustc.git/blob - src/jemalloc/include/jemalloc/internal/smoothstep.sh
3 # Generate a discrete lookup table for a sigmoid function in the smoothstep
4 # family (https://en.wikipedia.org/wiki/Smoothstep), where the lookup table
5 # entries correspond to x in [1/nsteps, 2/nsteps, ..., nsteps/nsteps]. Encode
6 # the entries using a binary fixed point representation.
8 # Usage: smoothstep.sh <variant> <nsteps> <bfp> <xprec> <yprec>
10 # <variant> is in {smooth, smoother, smoothest}.
11 # <nsteps> must be greater than zero.
12 # <bfp> must be in [0..62]; reasonable values are roughly [10..30].
13 # <xprec> is x decimal precision.
14 # <yprec> is y decimal precision.
18 cmd
="sh smoothstep.sh $*"
33 echo "Unsupported variant"
40 y
=`echo ${yprec} k ${step} ${nsteps} / sx _2 lx 3 ^ '*' 3 lx 2 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
41 h
=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
46 y
=`echo ${yprec} k ${step} ${nsteps} / sx 6 lx 5 ^ '*' _15 lx 4 ^ '*' + 10 lx 3 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
47 h
=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
52 y
=`echo ${yprec} k ${step} ${nsteps} / sx _20 lx 7 ^ '*' 70 lx 6 ^ '*' + _84 lx 5 ^ '*' + 35 lx 4 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
53 h
=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
58 * This file was generated by the following command:
61 /******************************************************************************/
62 #ifdef JEMALLOC_H_TYPES
65 * This header defines a precomputed table based on the smoothstep family of
66 * sigmoidal curves (https://en.wikipedia.org/wiki/Smoothstep) that grow from 0
67 * to 1 in 0 <= x <= 1. The table is stored as integer fixed point values so
68 * that floating point math can be avoided.
71 * smoothstep(x) = -2x + 3x
74 * smootherstep(x) = 6x - 15x + 10x
77 * smootheststep(x) = -20x + 70x - 84x + 35x
80 #define SMOOTHSTEP_VARIANT "${variant}"
81 #define SMOOTHSTEP_NSTEPS ${nsteps}
82 #define SMOOTHSTEP_BFP ${bfp}
84 /* STEP(step, h, x, y) */ \\
88 while [ $s -le $nsteps ] ; do
90 x
=`echo ${xprec} k ${s} ${nsteps} / p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
91 printf ' STEP(%4d, UINT64_C(0x%016x), %s, %s) \\\n' ${s} ${h} ${x} ${y}
98 #endif /* JEMALLOC_H_TYPES */
99 /******************************************************************************/
100 #ifdef JEMALLOC_H_STRUCTS
103 #endif /* JEMALLOC_H_STRUCTS */
104 /******************************************************************************/
105 #ifdef JEMALLOC_H_EXTERNS
108 #endif /* JEMALLOC_H_EXTERNS */
109 /******************************************************************************/
110 #ifdef JEMALLOC_H_INLINES
113 #endif /* JEMALLOC_H_INLINES */
114 /******************************************************************************/