-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- proper handling of token amounts - code cleanup
- Loading branch information
Showing
8 changed files
with
240 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @brief | ||
* @file math.c | ||
* @author J.H. | ||
* @date 2018-11-07 | ||
*/ | ||
|
||
/* system includes */ | ||
|
||
/* local includes */ | ||
#include "math.h" | ||
|
||
|
||
uint64_t ipow(uint64_t base, uint8_t exp) | ||
{ | ||
uint64_t result = 1; | ||
for (;;) | ||
{ | ||
if (exp & 1) { result *= base; } | ||
exp >>= 1; | ||
if (!exp) { break; } | ||
base *= base; | ||
} | ||
|
||
return result; | ||
} |
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,18 @@ | ||
#ifndef _MATH_H_ | ||
#define _MATH_H_ | ||
/* system includes */ | ||
#include <stdint.h> | ||
/* local includes */ | ||
|
||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
uint64_t ipow(uint64_t base, uint8_t exp); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _MATH_H_ */ | ||
|
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
Oops, something went wrong.