Method and device for copying memory
A copying method and a technology of a copying device, which are applied in the field of computers and can solve problems affecting the copying of small and medium bytes
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0115] Embodiment 1, a memory copy method, such as figure 1 shown, including:
[0116] S101. Determine whether the length L of the memory to be copied is less than the first length threshold, and proceed to step S102 when the length L is less than the first length threshold;
[0117] S102. Among multiple predetermined length intervals, determine a length interval corresponding to the length L;
[0118] S103. Starting from the source address rsi of the memory to be copied, copy min bytes to the min bytes starting from the destination address rdi; start from rsi+L-N bytes, copy N bytes to rdi+L-N In the first N bytes; wherein, the max and min are the upper and lower limit values of the determined length interval respectively; N is a fixed integer greater than or equal to max-min and less than or equal to L.
[0119] Every time a memory copy is performed, the length, source address and destination address of the memory to be copied are determined, and the above length L, sour...
Embodiment 2
[0209] Embodiment 2, a memory replication device, comprising:
[0210] A first judging unit, configured to judge whether the length L of the memory to be copied is less than a first length threshold;
[0211] The second judging unit is configured to, when the judging result of the first judging unit is that the length L is less than the first length threshold, among a plurality of predetermined length intervals, determine a length interval corresponding to the length L;
[0212] The first copying unit is used to start from the source address rsi of the memory to be copied, copy min bytes to the min bytes starting from the destination address rdi; start from rsi+L-N, copy N bytes to rdi In the N bytes starting from +L-N; wherein, the max and min are respectively the upper and lower limit values of the determined length interval; N is a fixed integer, and L≥N≥max-min.
[0213] In an implementation manner of this embodiment, the N is an integer power of 2 that is greater than ...
Embodiment 3
[0232] Embodiment 3. A memory copy method, comprising:
[0233] Judging whether the length L of the memory used to store the data to be copied is less than the first length threshold;
[0234] When the length L is less than the first length threshold, among a plurality of predetermined length intervals, determine a length interval corresponding to the length L;
[0235] The data to be copied is saved in the min bytes starting from the destination address rdi in the memory; the data to be copied is saved in the N bytes starting from rdi+L-N in the memory; wherein, the max and min are determined respectively The upper and lower limits of the length interval; N is a fixed integer, and L≥N≥max-min.
[0236] This embodiment is applicable to the situation of copying data in registers or other storage spaces into memory, such as writing data in a 16-byte register into a 64-byte memory (that is, the 64-byte memory after writing 4 sections of the same data are stored in sequence in t...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


