summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorflacs <tilkax@gmail.com>2015-09-15 20:40:05 +0200
committerflacs <tilkax@gmail.com>2015-09-15 20:40:05 +0200
commit955bef226ec253afe5e30eabde24b9f38166fa50 (patch)
tree9f2d4c317e0f144aaea22a24fe8e9932b9ff0749 /Source/Core
parent7eeeb9f7542d4abb07e0a026f2f5e792bec4191a (diff)
parent2c5c99ec71e808679ac4763f82ad876f440e0b2c (diff)
Merge pull request #3041 from lioncash/align
Common: Get rid of a few pointer casts
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/LinearDiskCache.h9
-rw-r--r--Source/Core/Common/x64CPUDetect.cpp6
2 files changed, 8 insertions, 7 deletions
diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h
index 6b71508969..a00eb7ab37 100644
--- a/Source/Core/Common/LinearDiskCache.h
+++ b/Source/Core/Common/LinearDiskCache.h
@@ -170,14 +170,15 @@ private:
struct Header
{
Header()
- : id(*(u32*)"DCAC")
- , key_t_size(sizeof(K))
+ : key_t_size(sizeof(K))
, value_t_size(sizeof(V))
{
- memcpy(ver, scm_rev_git_str, 40);
+ // Null-terminator is intentionally not copied.
+ std::memcpy(&id, "DCAC", sizeof(u32));
+ std::memcpy(ver, scm_rev_git_str, 40);
}
- const u32 id;
+ u32 id;
const u16 key_t_size, value_t_size;
char ver[40];
diff --git a/Source/Core/Common/x64CPUDetect.cpp b/Source/Core/Common/x64CPUDetect.cpp
index 8bce493b5a..23b279dbb8 100644
--- a/Source/Core/Common/x64CPUDetect.cpp
+++ b/Source/Core/Common/x64CPUDetect.cpp
@@ -82,9 +82,9 @@ void CPUInfo::Detect()
// Detect CPU's CPUID capabilities, and grab CPU string
__cpuid(cpu_id, 0x00000000);
u32 max_std_fn = cpu_id[0]; // EAX
- *((int *)brand_string) = cpu_id[1];
- *((int *)(brand_string + 4)) = cpu_id[3];
- *((int *)(brand_string + 8)) = cpu_id[2];
+ std::memcpy(&brand_string[0], &cpu_id[1], sizeof(int));
+ std::memcpy(&brand_string[4], &cpu_id[3], sizeof(int));
+ std::memcpy(&brand_string[8], &cpu_id[2], sizeof(int));
__cpuid(cpu_id, 0x80000000);
u32 max_ex_fn = cpu_id[0];
if (!strcmp(brand_string, "GenuineIntel"))