Comments (5)
Thanks - do you know if that also an issue with the deserialization functions where we do this?
size_t deserialize16(const unsigned char *buf, uint16_t *data)
{
*data = ntohs(*reinterpret_cast<const uint16_t *>(buf));
return sizeof(*data);
}
from stratagus.
Yes, the same exact reasonning also applies.
Assigning through a non-aligned pointer is undefined behaviour, and will mislead the optimizer, which will make the assumption that the pointer is properly aligned.
Using memcpy
solves this issue because a call to memcpy
isn't an assignment, and thus, doesn't require anything on the alignment. Thus the compiler won't make wrong assumptions here.
from stratagus.
@Ace17 thanks a lot for the pointers, could I bother you to take a peek at https://github.com/Wargus/stratagus/pull/426/files where I tried to fix these issues where I could find them?
from stratagus.
Hi @timfel , this definitely looks good to me!
from stratagus.
Thank you!
from stratagus.
Related Issues (20)
- Does not build with vorbis disabled, but theora enabled
- Idea: Investigate sdl-gpu to have cleaner shader rendering code
- Move `~/.stratagus` elsewhere? HOT 5
- Use-after-free of a COrder_Resource on victory HOT 2
- Memleak in genversion.cpp
- Menu backgrounds not working on Mac OS HOT 2
- Unable to build master branch on Mac OS due to use of malloc and memalign() HOT 4
- stratagus/iolib.cpp fails to build on FreeBSD-14-Current; Clang-14.0.5: missing include
- Fix the depot pointer crash with GameSettings.AllyDepositsAllowed
- AppImage for Stratagus and Stargus on Linux! HOT 8
- Crash on startup HOT 1
- Wargus Multiplayer crashing in 3.3.2 HOT 2
- Bug with the Extraction process? HOT 4
- 'Open' on lines 70,71,72 in astar.cpp prevents compiling HOT 2
- adding ultrawide resolutions HOT 2
- Crash at the end of the mission
- Failed to load game data - Orc Campaign 6 (Sunnyglade Victory)
- Crash when starting second scenario, after Hillsbrad and briefing
- Screen flashes when starting new building construction HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stratagus.