Skip to content

Commit

Permalink
ggml : define MIN / MAX only if not defined (minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Jan 5, 2023
1 parent 0be6a1a commit d51c5eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ typedef void* thread_ret_t;
#define GGML_MEM_ALIGN 16
#endif

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define UNUSED(x) (void)(x)
#define SWAP(x, y, T) do { T SWAP = x; x = y; y = SWAP; } while (0)

Expand All @@ -108,6 +105,11 @@ typedef void* thread_ret_t;
#include <cblas.h>
#endif

#undef MIN
#undef MAX
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

// floating point type used to accumulate sums
typedef double ggml_float;

Expand Down
5 changes: 2 additions & 3 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,8 @@ struct whisper_context {
};

template<typename T>
static void read_safe(std::ifstream& fin, T& dest)
{
fin.read((char*)& dest, sizeof(T));
static void read_safe(std::ifstream& fin, T& dest) {
fin.read((char*)& dest, sizeof(T));
}

// load the model from a ggml file
Expand Down
2 changes: 1 addition & 1 deletion whisper.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern "C" {
struct whisper_context * ctx,
const char * text,
whisper_token * tokens,
int n_max_tokens);
int n_max_tokens);

// Largest language id (i.e. number of available languages - 1)
WHISPER_API int whisper_lang_max_id();
Expand Down

0 comments on commit d51c5eb

Please sign in to comment.