-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from malikalhack/polymorphism
The implementation of basic functionality that reflects the principle of polymorphism.
- Loading branch information
Showing
17 changed files
with
1,276 additions
and
98 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,25 @@ | ||
/** | ||
* @file common.h | ||
* @version 1.0.0 | ||
* @authors Anton Chernov | ||
* @date 02/11/2022 | ||
*/ | ||
|
||
#ifndef COMMON_H | ||
#define COMMON_H | ||
/****************************** Included files ********************************/ | ||
#include <stdint.h> | ||
/******************************** Definition **********************************/ | ||
typedef uint16_t coordinate_t; | ||
typedef signed short offset_t; | ||
typedef unsigned short abs_offset_t; | ||
/************************* Public functions prototypes ************************/ | ||
|
||
/** | ||
* @brief A simple function to return the modulus of a number. | ||
* @param[in] - the passed number | ||
* @returns the absolute value of the number | ||
*/ | ||
abs_offset_t abs(offset_t); | ||
/******************************************************************************/ | ||
#endif /* !COMMON_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @file common.c | ||
* @version 1.0.0 | ||
* @authors Anton Chernov | ||
* @date 02/11/2022 | ||
*/ | ||
|
||
/****************************** Included files ********************************/ | ||
#include "common.h" | ||
/***************************** Public functions *******************************/ | ||
abs_offset_t abs(offset_t num) { | ||
return (abs_offset_t)(num < 0 ? num *= -1 : num); | ||
} | ||
/******************************************************************************/ |
Oops, something went wrong.