Download OpenTimer_OpenTimer/ot/utility/utility.hpp from SAIFIINDUSTRIES/verilog_data-2: direct link, hf CLI and curl.
- Browser
- Download file 844 Bytes
-
https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-2/resolve/main/OpenTimer_OpenTimer/ot/utility/utility.hpp
- Command line
-
hf download hf://datasets/SAIFIINDUSTRIES/verilog_data-2/OpenTimer_OpenTimer/ot/utility/utility.hpp
-
curl -L -o utility.hpp https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-2/resolve/main/OpenTimer_OpenTimer/ot/utility/utility.hpp
844 Bytes
| // Miscellaneous | |
| namespace ot { | |
| // Concatnate a string | |
| template <typename... Ts> | |
| std::string to_string(Ts&&... ts) { | |
| std::ostringstream oss; | |
| (oss << ... << ts); | |
| return oss.str(); | |
| } | |
| // Resize a container to fit a given size | |
| template <typename T> | |
| void resize_to_fit(size_t N, T& v) { | |
| auto sz = v.size(); | |
| for(; sz < N; sz = (sz==0) ? 32 : (sz << 1)); | |
| v.resize(sz); | |
| } | |
| // Resize containers to fit a given size | |
| template <typename... T, std::enable_if_t<(sizeof...(T)>1), void>* = nullptr> | |
| void resize_to_fit(size_t N, T&...vs) { | |
| (resize_to_fit(N, vs), ...); | |
| } | |
| }; | |