]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
ggml : define MIN / MAX only if not defined (minor)
authorGeorgi Gerganov <redacted>
Thu, 5 Jan 2023 19:07:50 +0000 (21:07 +0200)
committerGeorgi Gerganov <redacted>
Thu, 5 Jan 2023 19:16:52 +0000 (21:16 +0200)
bindings/ios
ggml.c
whisper.cpp
whisper.h

index 1502317fe050c1d5ae1a81082153b8f00d50d9cd..6707f1ea1caa7ee5e9b6908101fe98775e582cff 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1502317fe050c1d5ae1a81082153b8f00d50d9cd
+Subproject commit 6707f1ea1caa7ee5e9b6908101fe98775e582cff
diff --git a/ggml.c b/ggml.c
index ddcdea57d574c2a9b374cfd6e5d3370d095c5886..5ce44d26ff28a806f2b8f533431c6e27d70a3e10 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -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)
 
@@ -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;
 
index 84c24900791a6427a581b86bd1741991ae230394..8cfe04c84baade15aa9e0d21ebcf688e45e06c0c 100644 (file)
@@ -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
index e36b761ff6f9df3cfe30ab3ea30baf0362bb3ee8..8cb16caaeea9cc19b5efd7306b9a26cbc574493f 100644 (file)
--- a/whisper.h
+++ b/whisper.h
@@ -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();