-
Notifications
You must be signed in to change notification settings - Fork 161
Big cast cleanup #3076
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
Merged
Merged
Big cast cleanup #3076
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
72dc225
Big cast cleanup
roeming e52678b
fix for name conflict
roeming fe3bad7
rename header
roeming fe9afba
rename cast macros
roeming 89a2255
fix rename mistake
roeming c898211
Merge branch 'zeldaret:main' into cast_add_cleanup
roeming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #ifndef _CASTED_MATH_H_ | ||
| #define _CASTED_MATH_H_ | ||
|
|
||
| #include "global.h" | ||
| #include "types.h" | ||
|
|
||
| #define ADD_VAR(x, y) ((x) += (y)) | ||
| #define SUB_VAR(x, y) ((x) -= (y)) | ||
| #define MULT_VAR(x, y) ((x) *= (y)) | ||
|
|
||
| #define ADD_VAR_CAST(x, y, t) ((x) += (t)(y)) | ||
| #define SUB_VAR_CAST(x, y, t) ((x) -= (t)(y)) | ||
| #define MULT_VAR_CAST(x, y, t) ((x) *= (t)(y)) | ||
|
|
||
| #define ADD_S8(x, y) ADD_VAR_CAST(x, y, s8) | ||
| #define ADD_U8(x, y) ADD_VAR_CAST(x, y, u8) | ||
| #define ADD_S16(x, y) ADD_VAR_CAST(x, y, s16) | ||
| #define ADD_U16(x, y) ADD_VAR_CAST(x, y, u16) | ||
| #define ADD_S32(x, y) ADD_VAR_CAST(x, y, s32) | ||
| #define ADD_U32(x, y) ADD_VAR_CAST(x, y, u32) | ||
|
|
||
| #define SUB_S8(x, y) SUB_VAR_CAST(x, y, s8) | ||
| #define SUB_U8(x, y) SUB_VAR_CAST(x, y, u8) | ||
| #define SUB_S16(x, y) SUB_VAR_CAST(x, y, s16) | ||
| #define SUB_U16(x, y) SUB_VAR_CAST(x, y, u16) | ||
| #define SUB_S32(x, y) SUB_VAR_CAST(x, y, s32) | ||
| #define SUB_U32(x, y) SUB_VAR_CAST(x, y, u32) | ||
|
|
||
| #define MULT_S8(x, y) MULT_VAR_CAST(x, y, s8) | ||
| #define MULT_U8(x, y) MULT_VAR_CAST(x, y, u8) | ||
| #define MULT_S16(x, y) MULT_VAR_CAST(x, y, s16) | ||
| #define MULT_U16(x, y) MULT_VAR_CAST(x, y, u16) | ||
| #define MULT_S32(x, y) MULT_VAR_CAST(x, y, s32) | ||
| #define MULT_U32(x, y) MULT_VAR_CAST(x, y, u32) | ||
|
|
||
| #define ADD_ANGLE(x, y) ADD_S16(x, y) | ||
roeming marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #define SUB_ANGLE SUB_S16 | ||
| #define MULT_ANGLE MULT_S16 | ||
|
|
||
| // There are some angles that weren't sign-extended until the shield version | ||
| #if !PLATFORM_SHIELD | ||
| #define ADD_S8_2 ADD_VAR | ||
| #define ADD_U8_2 ADD_VAR | ||
| #define ADD_S16_2 ADD_VAR | ||
| #define ADD_U16_2 ADD_VAR | ||
| #define ADD_S32_2 ADD_VAR | ||
| #define ADD_U32_2 ADD_VAR | ||
|
|
||
| #define SUB_S8_2 SUB_VAR | ||
| #define SUB_U8_2 SUB_VAR | ||
| #define SUB_S16_2 SUB_VAR | ||
| #define SUB_U16_2 SUB_VAR | ||
| #define SUB_S32_2 SUB_VAR | ||
| #define SUB_U32_2 SUB_VAR | ||
|
|
||
| #define MULT_S8_2 MULT_VAR | ||
| #define MULT_U8_2 MULT_VAR | ||
| #define MULT_S16_2 MULT_VAR | ||
| #define MULT_U16_2 MULT_VAR | ||
| #define MULT_S32_2 MULT_VAR | ||
| #define MULT_U32_2 MULT_VAR | ||
| #else | ||
| #define ADD_S8_2 ADD_S8 | ||
| #define ADD_U8_2 ADD_U8 | ||
| #define ADD_S16_2 ADD_S16 | ||
| #define ADD_U16_2 ADD_U16 | ||
| #define ADD_S32_2 ADD_S32 | ||
| #define ADD_U32_2 ADD_U32 | ||
|
|
||
| #define SUB_S8_2 SUB_S8 | ||
| #define SUB_U8_2 SUB_U8 | ||
| #define SUB_S16_2 SUB_S16 | ||
| #define SUB_U16_2 SUB_U16 | ||
| #define SUB_S32_2 SUB_S32 | ||
| #define SUB_U32_2 SUB_U32 | ||
|
|
||
| #define MULT_S8_2 MULT_S8 | ||
| #define MULT_U8_2 MULT_U8 | ||
| #define MULT_S16_2 MULT_S16 | ||
| #define MULT_U16_2 MULT_U16 | ||
| #define MULT_S32_2 MULT_S32 | ||
| #define MULT_U32_2 MULT_U32 | ||
| #endif | ||
|
|
||
| #define ADD_ANGLE_2 ADD_S16_2 | ||
| #define SUB_ANGLE_2 SUB_S16_2 | ||
| #define MULT_ANGLE_2 MULT_S16_2 | ||
|
|
||
| #endif // !_CASTED_MATH_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.