Spaces:
Paused
Paused
Download NvidiaWarp-GarmentCode/warp/native/runlength_encode.cpp from qbhf2/GarmentCode: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/qbhf2/GarmentCode/resolve/main/NvidiaWarp-GarmentCode/warp/native/runlength_encode.cpp
- Command line
-
hf download hf://spaces/qbhf2/GarmentCode/NvidiaWarp-GarmentCode/warp/native/runlength_encode.cpp
-
curl -L -o runlength_encode.cpp https://huggingface.co/spaces/qbhf2/GarmentCode/resolve/main/NvidiaWarp-GarmentCode/warp/native/runlength_encode.cpp
1.33 kB
| template <typename T> | |
| void runlength_encode_host(int n, | |
| const T *values, | |
| T *run_values, | |
| int *run_lengths, | |
| int *run_count) | |
| { | |
| if (n == 0) | |
| { | |
| *run_count = 0; | |
| return; | |
| } | |
| const T *end = values + n; | |
| *run_count = 1; | |
| *run_lengths = 1; | |
| *run_values = *values; | |
| while (++values != end) | |
| { | |
| if (*values == *run_values) | |
| { | |
| ++*run_lengths; | |
| } | |
| else | |
| { | |
| ++*run_count; | |
| *(++run_lengths) = 1; | |
| *(++run_values) = *values; | |
| } | |
| } | |
| } | |
| void runlength_encode_int_host( | |
| uint64_t values, | |
| uint64_t run_values, | |
| uint64_t run_lengths, | |
| uint64_t run_count, | |
| int n) | |
| { | |
| runlength_encode_host<int>(n, | |
| reinterpret_cast<const int *>(values), | |
| reinterpret_cast<int *>(run_values), | |
| reinterpret_cast<int *>(run_lengths), | |
| reinterpret_cast<int *>(run_count)); | |
| } | |
| void runlength_encode_int_device( | |
| uint64_t values, | |
| uint64_t run_values, | |
| uint64_t run_lengths, | |
| uint64_t run_count, | |
| int n) | |
| { | |
| } | |