Skip to content

Instantly share code, notes, and snippets.

@afulsamet
afulsamet / main.cpp
Created October 4, 2022 22:10
Inline string with using bit_cast (std:c++20)
#include <bit>
#include <array>
int main()
{
// Create raw array in stack: rsp+2C
volatile std::uint32_t stack[3];
// mov dword ptr ss:[rsp+2C], 6C6C6548
stack[0] = std::integral_constant<std::uint32_t, std::bit_cast<std::uint32_t>(std::array<char, sizeof(std::uint32_t)>{'H', 'e', 'l', 'l'})>::value;