1 #include <stddef.h>
2 
3 #include <cpuinfo.h>
4 #include <cpuinfo/internal-api.h>
5 
6 
cpuinfo_compute_max_cache_size(const struct cpuinfo_processor * processor)7 uint32_t cpuinfo_compute_max_cache_size(const struct cpuinfo_processor* processor) {
8   if (processor->cache.l4 != NULL) {
9     return processor->cache.l4->size;
10   } else if (processor->cache.l3 != NULL) {
11     return processor->cache.l3->size;
12   } else if (processor->cache.l2 != NULL) {
13     return processor->cache.l2->size;
14   } else if (processor->cache.l1d != NULL) {
15     return processor->cache.l1d->size;
16   }
17   return 0;
18 }
19