tweaked comments and includes

This commit is contained in:
Roland W-H 2022-11-19 16:38:49 +00:00
parent 7fe3d3c107
commit 738bd9a99c
2 changed files with 11 additions and 3 deletions

View File

@ -29,10 +29,7 @@ int main()
fgets(buf, 3, stdin);
int choice = strtol(buf, NULL, 10);
//char* msg = calloc(128, sizeof(char));
fputs("Enter your message text: ", stdout);
//if (msg) fgets(msg, 128, stdin);
char* msg = dyninput_str(INT64_MAX);
fputs("Enter your key (shift value): ", stdout);

View File

@ -12,6 +12,12 @@
#include <stdbool.h>
/*
* For built in C mod operator (%) -1 % 26 == -1
* For the requirements of this algorithm -1 mod 26 == 25 is required
* The below functions accomplish this
*/
// Which of the two below functions is faster (find out!)
inline int mod(int a, int b)
{
@ -26,6 +32,11 @@ inline int fast_mod(int a, int b)
}
/*
* 65 - 90 = ASCII 'A' - 'Z'
* 97 - 122 = ASCII 'a' - 'z'
*/
inline bool isupper(char c)
{
return c >= 'A' && c <= 'Z';