-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2023 Xu Shaohua <[email protected]>. All rights reserved. | ||
// Use of this source is governed by GNU General Public License | ||
// that can be found in the LICENSE file. | ||
|
||
#ifndef CII_ARITH_H_ | ||
#define CII_ARITH_H_ | ||
|
||
/** | ||
* Returns the maximum of two integers. | ||
* @param x | ||
* @param y | ||
* @return | ||
*/ | ||
extern int arith_max(int x, int y); | ||
|
||
/** | ||
* Returns the minimum of two integers. | ||
* @param x | ||
* @param y | ||
* @return | ||
*/ | ||
extern int arith_min(int x, int y); | ||
|
||
/** | ||
* Returns quotient of dividing |x| by |y|. | ||
* | ||
* When |x| and |y| are both positive or both negative, this function is equals | ||
* to x / y. | ||
* @param x | ||
* @param y | ||
* @return | ||
*/ | ||
extern int arith_div(int x, int y); | ||
|
||
/** | ||
* Returns remainder of dividing x by y. | ||
* | ||
* When |x| and |y| are both positive or both negative, this function is equals | ||
* x % y. | ||
* | ||
* @param x | ||
* @param y | ||
* @return | ||
*/ | ||
extern int arith_mod(int x, int y); | ||
|
||
extern int arith_ceiling(int x, int y); | ||
|
||
extern int arith_floor(int x, int y); | ||
|
||
#endif // CII_ARITH_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2023 Xu Shaohua <[email protected]>. All rights reserved. | ||
// Use of this source is governed by GNU General Public License | ||
// that can be found in the LICENSE file. | ||
|
||
#include "cii/arith.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