Skip to content
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

Add support for basic type min/max values #2794

Open
rkaric opened this issue Mar 13, 2024 · 2 comments
Open

Add support for basic type min/max values #2794

rkaric opened this issue Mar 13, 2024 · 2 comments
Labels
Good First Issue Good for new contributors

Comments

@rkaric
Copy link

rkaric commented Mar 13, 2024

In C/C++ it's possible to use values such as INT_MAX or FLT_MAX by including a standard library header such as <limits.h> or <float.h>. It would be nice if there was some way for ISPC to offer those as well. Perhaps through predefined preprocessor symbols or a standard library header?

https://en.cppreference.com/w/c/types/limits

@aneshlya
Copy link
Collaborator

ISPC has limits for integral types in stdlib:
INT8_MAX/INT8_MIN, INT16_MAX/INT16_MIN, INT32_MAX/INT32_MIN, INT64_MAX/INT64_MIN, UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX .
But doesn't have for floating point types.
Plus, no mentions of it in documentation.

@nurmukhametov
Copy link
Collaborator

ISPC has limits for integral types in stdlib: INT8_MAX/INT8_MIN, INT16_MAX/INT16_MIN, INT32_MAX/INT32_MIN, INT64_MAX/INT64_MIN, UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX .

They are internal stdlib.ispc definitions that are unavailable for users.

So, this example

uniform int foo() {
   return INT32_MIN;
}

results to

<source>:4:11: Error: Undeclared symbol "INT32_MIN". 
   return INT32_MIN;
          ^^^^^^^^^

@aneshlya aneshlya self-assigned this Mar 15, 2024
@aneshlya aneshlya removed their assignment Mar 27, 2024
@pbrubaker pbrubaker added the Good First Issue Good for new contributors label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for new contributors
Projects
Status: No status
Development

No branches or pull requests

4 participants