Skip to content

Commit

Permalink
no need to ref char ProAlgos#396 ProAlgos#99
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWaleed committed Jan 30, 2021
1 parent cebef49 commit c1fd097
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpp/include/utils/data_conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#define UPPER_CASE_BIT_MASK 0b11011111
#define LOWER_CASE_BIT_MASK 0b00100000

bool is_letter(const char& c) {
bool is_letter(char c) {
char lower_cased_char = (char)(c | LOWER_CASE_BIT_MASK);
return lower_cased_char >= 'a' && lower_cased_char <= 'z';
}

std::string make_upper_case(const std::string& input) {
std::string result;
for (auto& c: input) {
for (auto c: input) {

if (is_letter(c)) {
result += c & UPPER_CASE_BIT_MASK;
Expand All @@ -42,7 +42,7 @@ std::string make_upper_case(const std::string& input) {

std::string make_lower_case(const std::string& input) {
std::string result;
for (auto& current_char: input) {
for (auto current_char: input) {

if (is_letter(current_char)) {
result += current_char | LOWER_CASE_BIT_MASK;
Expand Down

0 comments on commit c1fd097

Please sign in to comment.