mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
(struct cache_entry): Use uint64_t for hwcap. (print_entry): Likewise. (add_to_cache): Likewise.
This commit is contained in:
13
elf/cache.c
13
elf/cache.c
@@ -25,6 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -38,7 +39,7 @@ struct cache_entry
|
|||||||
char *lib; /* Library name. */
|
char *lib; /* Library name. */
|
||||||
char *path; /* Path to find library. */
|
char *path; /* Path to find library. */
|
||||||
int flags; /* Flags to indicate kind of library. */
|
int flags; /* Flags to indicate kind of library. */
|
||||||
unsigned long int hwcap; /* Important hardware capabilities. */
|
uint64_t hwcap; /* Important hardware capabilities. */
|
||||||
int bits_hwcap; /* Number of bits set in hwcap. */
|
int bits_hwcap; /* Number of bits set in hwcap. */
|
||||||
struct cache_entry *next; /* Next entry in list. */
|
struct cache_entry *next; /* Next entry in list. */
|
||||||
};
|
};
|
||||||
@@ -51,7 +52,7 @@ static const char *flag_descr[] =
|
|||||||
|
|
||||||
/* Print a single entry. */
|
/* Print a single entry. */
|
||||||
static void
|
static void
|
||||||
print_entry (const char *lib, int flag, unsigned long int hwcap, const char *key)
|
print_entry (const char *lib, int flag, uint64_t hwcap, const char *key)
|
||||||
{
|
{
|
||||||
printf ("\t%s (", lib);
|
printf ("\t%s (", lib);
|
||||||
switch (flag & FLAG_TYPE_MASK)
|
switch (flag & FLAG_TYPE_MASK)
|
||||||
@@ -83,7 +84,7 @@ print_entry (const char *lib, int flag, unsigned long int hwcap, const char *key
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (hwcap != 0)
|
if (hwcap != 0)
|
||||||
printf (", hwcap: 0x%lx", hwcap);
|
printf (", hwcap: 0x%Lx", hwcap);
|
||||||
printf (") => %s\n", key);
|
printf (") => %s\n", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +412,7 @@ save_cache (const char *cache_name)
|
|||||||
/* Add one library to the cache. */
|
/* Add one library to the cache. */
|
||||||
void
|
void
|
||||||
add_to_cache (const char *path, const char *lib, int flags,
|
add_to_cache (const char *path, const char *lib, int flags,
|
||||||
unsigned long int hwcap)
|
uint64_t hwcap)
|
||||||
{
|
{
|
||||||
struct cache_entry *new_entry, *ptr, *prev;
|
struct cache_entry *new_entry, *ptr, *prev;
|
||||||
char *full_path;
|
char *full_path;
|
||||||
@@ -431,8 +432,8 @@ add_to_cache (const char *path, const char *lib, int flags,
|
|||||||
new_entry->bits_hwcap = 0;
|
new_entry->bits_hwcap = 0;
|
||||||
|
|
||||||
/* Count the number of bits set in the masked value. */
|
/* Count the number of bits set in the masked value. */
|
||||||
for (i = 0; (~((1UL << i) - 1) & hwcap) != 0; ++i)
|
for (i = 0; (~((1ULL << i) - 1) & hwcap) != 0; ++i)
|
||||||
if ((hwcap & (1UL << i)) != 0)
|
if ((hwcap & (1ULL << i)) != 0)
|
||||||
++new_entry->bits_hwcap;
|
++new_entry->bits_hwcap;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user