Skip to content

Instantly share code, notes, and snippets.

To load 64 bits (which is 8 bytes) of data into an __m128i register (which typically holds 128 bits or 16 bytes), you need to pad or extend the 64-bit data to fill the full width of the register.

Here are several ways to do this depending on your context:

1. Zero-Pad (Fill with zeros)

If you want to pad the remaining 8 bytes with zeros, you can use SSE2 instructions (movq followed by pslldq):

__m128i load64_zero_pad(uint64_t data) {
    __m128i result;

To load 64 bits (which is 8 bytes) of data into an __m128i register (typically used for 128-bit SSE operations), you need to use SSE instructions that load 8 bytes into the register.

Here are several ways to do this:

1. Using _mm_loadu_si64 (Unaligned Load)

  • This loads 8 bytes from memory into the lower half of the __m128i register.
  • The upper half remains undefined (or may be zeroed depending on implementation).
#include  // SSE2 header
@Microflame
Microflame / hollow_knight_save_editor.py
Created September 13, 2022 02:46
Simple save editor for Hollow Knight game
import argparse
from base64 import b64decode, b64encode
import json
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
c_sharp_header = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]
aes_key = b'UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'
cipher = AES.new(aes_key, AES.MODE_ECB)
@Microflame
Microflame / python_argparse.py
Last active August 15, 2022 20:30
Example usage of Python argparse module
import argparse
parser = argparse.ArgumentParser(description='App description')
# Named Argument
parser.add_argument('-f', '--foo')
# ./exe -f bar OR ./exe --foo bar
# foo -> bar
# Positional Argument