-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from robojumper/sLib_math
A bit of sLib math
- Loading branch information
Showing
14 changed files
with
587 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,13 @@ | ||
#ifndef RVL_SDK_OS_CRC_H | ||
#define RVL_SDK_OS_CRC_H | ||
#include <common.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
u32 OSCalcCRC32(const void *, u32); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif |
This file contains 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 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,12 @@ | ||
#ifndef S_CRC_H | ||
#define S_CRC_H | ||
|
||
#include <common.h> | ||
|
||
namespace sCrc { | ||
|
||
u32 calcCRC(const void *ptr, u32 size); | ||
|
||
} // namespace sCrc | ||
|
||
#endif |
This file contains 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,26 @@ | ||
#ifndef S_MATH_H | ||
#define S_MATH_H | ||
|
||
#include <common.h> | ||
|
||
namespace sLib { | ||
|
||
// Names from NSMBW | ||
float addCalc(float *value, float target, float ratio, float maxStepSize, float minStepSize); | ||
short addCalcAngle(short *value, short target, short ratio, short maxStepSize, short minStepSize); | ||
BOOL chase(short *value, short target, short stepSize); | ||
BOOL chase(int *value, int target, int stepSize); | ||
BOOL chase(float *value, float target, float stepSize); | ||
BOOL chaseAngle(short *value, short target, short stepSize); | ||
|
||
// Inofficial names | ||
float extrapolate(float start, float end, float scale); | ||
BOOL isInRange(float val, float min, float max); | ||
void addCalcScaledDiff(float *value, float target, float ratio, float maxStepSize); | ||
void addCalcScaled(float *value, float stepSize, float maxStep); | ||
int absDiff(short a1, short a2); | ||
BOOL chaseUC(u8 *value, u8 target, u8 stepSize); | ||
|
||
} // namespace sLib | ||
|
||
#endif |
This file contains 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,10 @@ | ||
#include <s/s_Crc.h> | ||
#include <rvl/OS.h> | ||
|
||
namespace sCrc { | ||
|
||
u32 calcCRC(const void *ptr, u32 size) { | ||
return OSCalcCRC32(ptr, size); | ||
} | ||
|
||
} // namespace sCrc |
Oops, something went wrong.