Skip to content

Instantly share code, notes, and snippets.

View Amirhb's full-sized avatar

Amir Hossein Babaeian Amirhb

View GitHub Profile
@Amirhb
Amirhb / Understanding_Endianness.md
Last active April 5, 2023 13:03
Understanding Endianness

Understanding Endianness in Computer Memory

Endianness refers to the way in which bytes are ordered in computer memory. It is essential to understand endianness when working with computer memory and saving or fetching numbers in it. There are two types of endianness: big-endian and little-endian.

Big-Endian

In big-endian, the most significant byte (MSB) is stored at the lowest memory address, while the least significant byte (LSB) is stored at the highest memory address. This means that if we have a 4-byte integer 0x12345678, it will be stored in memory as follows:

Address Value
@Amirhb
Amirhb / Address.sol
Last active March 22, 2021 11:52
Solidity library to check if an address pointing to a contract
// source: uniswap
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* > It is unsafe to assume that an address for which this function returns
@Amirhb
Amirhb / gist:71edde30496163fe4d10008cefac3b23
Last active May 23, 2018 08:23
Here are some things you can do with Gists in GistBox.
We couldn’t find that file to show.