Closed grimaldini closed 3 years ago
I'll try to reproduce the issue but from the looks of it, you are right.
Can you share which clang version is installed on your system (assuming you're using clang)?
Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin20.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I was able to fix this by adding some explicit casting in
template<typename T, typename... Ts>
inline const typename detail::tweentraits<T, Ts...>::valuesType & tween<T, Ts...>::jump(int32_t p, bool suppress) {
p = detail::clip(p, 0, (int32_t)(points.size() -1)); // <- here
return seek((int32_t)(points.at(p).stacked), suppress); // <- here
}
I think you could also make p be a size_type
here to avoid the casting and to optimize it for different architectures.
Additionally, the same issue occurs in the interpolate function, to fix it you could do an explicit cast as below:
auto pointDuration = uint32_t(p.duration() - (p.stacked - (prog * static_cast<float>(total))));
Yeah, I was going to write the same solution here but you beat me to it :)
Considering points.size()
will never be < 0
(under normal circumstances) and I'm already clipping p
to be positive, might as well be a size_type
indeed. Thanks for catching that.
I have adopted your suggestions. Thanks!
When trying to compile a simple hello world using the jump function, I'm getting "4. Candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'unsigned long')":
I'm using the stable single header file, all local paths have been replaced with *. Wondering if this might be due to vector.size() returning size_t that in some systems it might alias to different types.
Using a mac and Xcode