summaryrefslogtreecommitdiff
path: root/src/libs/din
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-12-31 12:26:05 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-12-31 12:30:55 -0800
commit93bba0927f0f1d3be8be472a9f4e7312d0be380d (patch)
treeb5eab93229489efb7c5c7b897f0d08562830529d /src/libs/din
parentd9cbdaf1eda5a2116087149313b3005e7e0a57be (diff)
libs/din: constify din_t for din()
din() just samples the din_t which will always just be a read-only operation, so constify this. It might even help the compiler generate faster code for din-heavy inner loops like modules/swab uses.
Diffstat (limited to 'src/libs/din')
-rw-r--r--src/libs/din/din.c2
-rw-r--r--src/libs/din/din.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/din/din.c b/src/libs/din/din.c
index aa71a2f..1cb0b97 100644
--- a/src/libs/din/din.c
+++ b/src/libs/din/din.c
@@ -94,7 +94,7 @@ static inline float smootherstep(float x) {
/* coordinate is in a unit cube of -1...+1 */
-float din(din_t *din, v3f_t *coordinate)
+float din(const din_t *din, v3f_t *coordinate)
{
int x0, y0, z0, x1, y1, z1;
float i1, i2, ii1, ii2;
diff --git a/src/libs/din/din.h b/src/libs/din/din.h
index 97823b6..ff25fb4 100644
--- a/src/libs/din/din.h
+++ b/src/libs/din/din.h
@@ -7,6 +7,6 @@ typedef struct v3f_t v3f_t;
din_t * din_new(int width, int height, int depth, unsigned seed);
void din_free(din_t *din);
void din_randomize(din_t *din);
-float din(din_t *din, v3f_t *coordinate);
+float din(const din_t *din, v3f_t *coordinate);
#endif
© All Rights Reserved