diff --git a/audio/utils.c b/audio/utils.c index 13f3397882..62cc40cccb 100644 --- a/audio/utils.c +++ b/audio/utils.c @@ -95,6 +95,7 @@ void audio_convert_float_to_s16_SSE2(int16_t *out, void audio_convert_s16_to_float_altivec(float *out, const int16_t *in, size_t samples, float gain) { + size_t samples_in = samples; const vector float gain_vec = { gain, gain , gain, gain }; const vector float zero_vec = { 0.0f, 0.0f, 0.0f, 0.0f}; // Unaligned loads/store is a bit expensive, so we optimize for the good path (very likely). @@ -113,15 +114,15 @@ void audio_convert_s16_to_float_altivec(float *out, vec_st(out_lo, 16, out); } - audio_convert_s16_to_float_C(out, in, samples - i, gain); + samples_in -= i; } - else - audio_convert_s16_to_float_C(out, in, samples, gain); + audio_convert_s16_to_float_C(out, in, samples_in, gain); } void audio_convert_float_to_s16_altivec(int16_t *out, const float *in, size_t samples) { + int samples_in = samples; // Unaligned loads/store is a bit expensive, so we optimize for the good path (very likely). if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0) { @@ -135,10 +136,9 @@ void audio_convert_float_to_s16_altivec(int16_t *out, vec_st(vec_packs(result0, result1), 0, out); } - audio_convert_float_to_s16_C(out, in, samples - i); + samples_in -= i; } - else - audio_convert_float_to_s16_C(out, in, samples); + audio_convert_float_to_s16_C(out, in, samples_in); } #elif defined(__ARM_NEON__) void audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain); // Avoid potential hard-float/soft-float ABI issues. diff --git a/driver.h b/driver.h index ce52b4d66d..dcf6e777eb 100644 --- a/driver.h +++ b/driver.h @@ -598,7 +598,7 @@ static inline bool input_key_pressed_func(int key) bool ret = false; if (!driver.block_hotkey) - ret = ret || driver.input->key_pressed(driver.input_data, key); + ret = driver.input->key_pressed(driver.input_data, key); #ifdef HAVE_OVERLAY ret = ret || (driver.overlay_state.buttons & (1ULL << key)); diff --git a/file_extract.c b/file_extract.c index 3f44f4b239..75269a466f 100644 --- a/file_extract.c +++ b/file_extract.c @@ -346,8 +346,7 @@ static bool zip_extract_cb(const char *name, const uint8_t *cdata, unsigned cmod data->found_content = true; return false; } - else - return false; + return false; default: return false; @@ -425,7 +424,7 @@ struct string_list *zlib_get_file_list(const char *path) string_list_free(list); return NULL; } - else - return list; + + return list; } diff --git a/file_path.c b/file_path.c index 79db10cd25..2b8746c596 100644 --- a/file_path.c +++ b/file_path.c @@ -59,15 +59,14 @@ // Dump stuff to file. bool write_file(const char *path, const void *data, size_t size) { + bool ret = false; FILE *file = fopen(path, "wb"); if (!file) return false; - else - { - bool ret = fwrite(data, 1, size, file) == size; - fclose(file); - return ret; - } + + ret = fwrite(data, 1, size, file) == size; + fclose(file); + return ret; } // Generic file loader. @@ -170,7 +169,8 @@ static bool string_list_capacity(struct string_list *list, size_t cap) { rarch_assert(cap > list->size); - struct string_list_elem *new_data = (struct string_list_elem*)realloc(list->elems, cap * sizeof(*new_data)); + struct string_list_elem *new_data = (struct string_list_elem*) + realloc(list->elems, cap * sizeof(*new_data)); if (!new_data) return false; @@ -307,8 +307,7 @@ const char *path_get_extension(const char *path) const char *ext = strrchr(path_basename(path), '.'); if (ext) return ext + 1; - else - return ""; + return ""; } char *path_remove_extension(char *path) @@ -337,8 +336,7 @@ static int qstrcmp_dir(const void *a_, const void *b_) // Sort directories before files. if (a_dir != b_dir) return b_dir - a_dir; - else - return strcasecmp(a->data, b->data); + return strcasecmp(a->data, b->data); } void dir_list_sort(struct string_list *list, bool dir_first) @@ -421,8 +419,7 @@ static bool dirent_is_directory(const char *path, const struct dirent *entry) else if (entry->d_type == DT_UNKNOWN // This can happen on certain file systems. || entry->d_type == DT_LNK) return path_is_directory(path); - else - return false; + return false; #else // dirent struct doesn't have d_type, do it the slow way ... return path_is_directory(path); #endif @@ -498,7 +495,7 @@ static bool path_char_is_slash(char c) #ifdef _WIN32 return (c == '/') || (c == '\\'); #else - return c == '/'; + return (c == '/'); #endif } @@ -656,8 +653,7 @@ const char *path_basename(const char *path) if (last) return last + 1; - else - return path; + return path; } bool path_is_absolute(const char *path)