]> git.sesse.net Git - vlc/blobdiff - src/misc/cpu.c
Add obsolete option for all --*-caching values
[vlc] / src / misc / cpu.c
index 490fe5cfcaf424d62e1a0ee77cd60a95de97e90e..15de451c0d3d221c6d43f530b09d676ae8836ba6 100644 (file)
@@ -257,6 +257,10 @@ out:
 # if defined (__ARM_NEON__)
     i_capabilities |= CPU_CAPABILITY_NEON;
 # elif defined (CAN_COMPILE_NEON)
+#  define NEED_RUNTIME_CPU_CHECK 1
+# endif
+
+# ifdef NEED_RUNTIME_CPU_CHECK
 #  if defined (__linux__)
     FILE *info = fopen ("/proc/cpuinfo", "rt");
     if (info != NULL)
@@ -266,16 +270,18 @@ out:
 
         while (getline (&line, &linelen, info) != -1)
         {
-             const char *cap;
+            const char *cap;
 
-             if (strncmp (line, "Features\t:", 10))
-                 continue;
+            if (strncmp (line, "Features\t:", 10))
+                continue;
 
-             cap = strstr (line + 10, " neon");
-             if (cap != NULL && (cap[5] == '\0' || cap[5] == ' '))
-                 i_capabilities |= CPU_CAPABILITY_NEON;
-
-             break;
+            /* TODO: detect other CPU features when we use them */
+#   if defined (CAN_COMPILE_NEON) && !defined (__ARM_NEON__)
+                cap = strstr (line + 10, " neon");
+            if (cap != NULL && (cap[5] == '\0' || cap[5] == ' '))
+                i_capabilities |= CPU_CAPABILITY_NEON;
+#   endif
+            break;
         }
         fclose (info);
         free (line);
@@ -379,31 +385,3 @@ void *vlc_memcpy (void *tgt, const void *src, size_t n)
 {
     return pf_vlc_memcpy (tgt, src, n);
 }
-
-/**
- * Returned an aligned pointer on newly allocated memory.
- * \param alignment must be a power of 2 and a multiple of sizeof(void*)
- * \param size is the size of the usable memory returned.
- *
- * It must not be freed directly, *base must.
- */
-void *vlc_memalign(void **base, size_t alignment, size_t size)
-{
-    assert(alignment >= sizeof(void*));
-    for (size_t t = alignment; t > 1; t >>= 1)
-        assert((t&1) == 0);
-#if defined(HAVE_POSIX_MEMALIGN)
-    if (posix_memalign(base, alignment, size)) {
-        *base = NULL;
-        return NULL;
-    }
-    return *base;
-#elif defined(HAVE_MEMALIGN)
-    return *base = memalign(alignment, size);
-#else
-    unsigned char *p = *base = malloc(size + alignment - 1);
-    if (!p)
-        return NULL;
-    return (void*)((uintptr_t)(p + alignment - 1) & ~(alignment - 1));
-#endif
-}