---
eip: 7958
label: EIP-7958
title: EVM64 - Little endian opcodes
status: Stagnant
type: Standards Track
category: Core
created: 2025-05-26
requires: 7937
official: https://eips.ethereum.org/EIPS/eip-7958
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7958.md
canonical: https://eips.huatuo.xyz/eip-7958/
lang: en
tldr: Defines the little-endian companion opcodes (BYTE64, MLOAD64, MSTORE64, PUSH*64) for the proposed 64-bit EVM mode of EIP-7937.
tags: [evm, opcodes, evm64, performance, core]
---

# EIP-7958: EVM64 - Little endian opcodes

> Little endian opcodes `BYTE64`, `MLOAD64`, `MSTORE64`, and `PUSH*64` for EVM64

**TL;DR:** Defines the little-endian companion opcodes (BYTE64, MLOAD64, MSTORE64, PUSH*64) for the proposed 64-bit EVM mode of EIP-7937.

## What problem does it solve?

The EVM works on 256-bit words. That is convenient for hashes and token amounts, but wasteful for ordinary counters, indexes and loop arithmetic, which fit in 64 bits and run much faster natively on modern CPUs.

[EIP-7937](/eip-7937/) proposes "EVM64", a set of 64-bit variants of arithmetic and bitwise opcodes. That core proposal deliberately avoids any byte-order decisions. A few operations, however, cannot avoid them: picking a byte out of a number, loading or storing a number from memory, and pushing a literal from bytecode. EIP-7958 defines those operations in **little-endian** form, matching the native byte order of most hardware.

## How it works

All opcodes use the two-byte `0xc0xx` prefix space from EIP-7937 and cost `G_VERYLOW64 = 2` gas.

| Opcode | Code | Behaviour |
| --- | --- | --- |
| `BYTE64` | `0xc01a` | `(x >> i * 8) & 0xFF`, i.e. byte `i` counted from the least significant end |
| `MLOAD64` | `0xc051` | Read 8 bytes from memory as a little-endian 64-bit integer |
| `MSTORE64` | `0xc052` | Write the low 64 bits of a stack value to memory, little-endian |
| `PUSH2_64` … `PUSH8_64` | `0xc061`–`0xc067` | Push a 2- to 8-byte literal read little-endian |

64-bit mode only uses the least significant 64 bits; other 256-bit opcodes see the value zero-extended. Memory expansion for `MLOAD64`/`MSTORE64` is charged as 8 bytes.

Contrast with the existing EVM: `BYTE` counts from the most significant end and `MLOAD` reads 32 bytes big-endian.

## Sample code

Worked example from the spec, as annotated bytecode:

```text
; memory[0..8] = 01 02 03 04 05 06 07 08
PUSH1 0x00
MLOAD64          ; c0 51 -> stack: 0x0000...0807060504030201
PUSH1 0x00
MSTORE64         ; c0 52 -> memory[0..8] = 01 02 03 04 05 06 07 08 again

; PUSH8_64 with an 8-byte literal
c0 67 01 02 03 04 05 06 07 08   ; -> stack: 0x0000...0807060504030201
```

The same byte rule in Python:

```python
def byte64(x: int, i: int) -> int:
    return (x >> (i * 8)) & 0xFF   # i = 0 is the least significant byte

assert byte64(0x0807060504030201, 0) == 0x01
```

## Things to know

- **Status: Stagnant.** There has been no recent progress and it is not scheduled for any upgrade. It only makes sense if [EIP-7937](/eip-7937/) is adopted.
- Test cases, a reference implementation and security considerations are still marked "to be added" in the spec.
- Mixing these opcodes with existing big-endian `MLOAD`/`BYTE` code requires care: the same bytes in memory produce different numbers depending on which opcode reads them.
- For the full rationale behind 64-bit mode and its gas assumptions, read EIP-7937.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7958
