Skip to content

Commit bbe79a4

Browse files
committed
Update generate_cube.c
1 parent 8946267 commit bbe79a4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

LookupTable/generate_cube.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515

1616
typedef uint32_t (*lut_fn_t)(uint32_t);
1717

18-
// Function to generate a LUT dynamically
18+
/**
19+
* @brief Generate a lookup table (LUT) for a given function.
20+
*
21+
* @param size Size of the LUT.
22+
* @param func Function to compute LUT values.
23+
* @return uint32_t* Pointer to the generated LUT or NULL on failure.
24+
*/
1925
uint32_t* generate_lut(size_t size, lut_fn_t func) {
2026
uint32_t* table = malloc(size * sizeof(uint32_t));
2127
if (table == NULL) {
@@ -28,7 +34,12 @@ uint32_t* generate_lut(size_t size, lut_fn_t func) {
2834
return table;
2935
}
3036

31-
// Example transformation function
37+
/**
38+
* @brief Compute the cube of a number.
39+
*
40+
* @param x Input number.
41+
* @return uint32_t Cube of the input number.
42+
*/
3243
uint32_t cube(uint32_t x) {
3344
return x * x * x;
3445
}

0 commit comments

Comments
 (0)