-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
op! macro does not support generics #207
Comments
For debugging macros in general, I have found In this particular case, the macro expansion is simple enough that it can be done by hand: type Output = <F32<S, E, M> as Shr<U>>::Output; Your actual issue is that your For example, in peano (which is like a simpler typenum that uses counting instead of binary for integer representation), here is how adding positive numbers is implemented: https://github.com/paholg/peano/blob/f8d288f133a90fde271fcc8164d74158cd7e9f70/src/lib.rs#L142-L152 The second In typenum, zero is representing by I suspect you can make your implementation work by having one |
I tried Could you explain how my |
Oh sorry, I misread. You're right, I don't think it is recursive. I'll try to look into this if I have time. |
Thank you! Essentially I am trying to implement F32s following IEEE 754 and I am calling Normalise after performing arithmetic operations to ensure that the mantissa is in the required range. |
Oh huh, I also misunderstood the error. It is a recursion in the macro, not the type resolution; this error shows up even if This is definitely a typenum bug. In the meantime, you can manually expand the code as I did. |
Aha, it's the way I wrote the macro. It expects all operands to be |
I only need to change to explicit version for uses of I will take a look at the macro later also. My dream for (totally useless), compile time fast inverse square root is alive still. |
Haha, that sounds great! Good luck with it! |
I am trying to implement the following trait as follows:
I have implemented
Shr<U: Unsigned>
forF32<S, E, M>
.However I am getting an error:
What am I doing wrong?
And how would you reccomend debugging such issues in the future?
The text was updated successfully, but these errors were encountered: