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

Consider simplifying the use of certain WINDOWS defines #4

Open
tannergooding opened this issue Apr 18, 2021 · 1 comment
Open

Consider simplifying the use of certain WINDOWS defines #4

tannergooding opened this issue Apr 18, 2021 · 1 comment

Comments

@tannergooding
Copy link

The majority of the WINDOWS and WIN64 usages look like they could be simplified to a different switch which indicated whether or not error reporting should be POSIX compliant.

That is, the code for a scenario such as (https://github.com/amd/aocl-libm-ose/blob/master/src/ref/acosf.c#L75-L85):

#ifdef WINDOWS
     return  __amd_handle_errorf("acosf", __amd_acos, ux|0x00400000, _DOMAIN, AMD_F_NONE, EDOM, x, 0.0F, 1);
#else
      //return x + x; /* With invalid if it's a signalling NaN */
      if (ux & QNAN_MASK_32)
     return  __amd_handle_errorf("acosf", __amd_acos, ux|0x00400000, _DOMAIN, AMD_F_NONE, EDOM, x, 0.0F, 1);
      else
     return  __amd_handle_errorf("acosf", __amd_acos, ux|0x00400000, _DOMAIN, AMD_F_INVALID, EDOM, x, 0.0F, 1);
#endif

Isn't a Windows vs not difference, it's a "POSIX" vs not difference. There may be scenarios on either platform where one or the other is preferred.

There are a few other ifdefs that look to decide if files such as intrin.h should be imported, and these could be simplified to just WINDOWS (rather than WIN64 or WINDOWS || WIN64).

@tannergooding
Copy link
Author

Happy to provide a fix here, if one is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant