当前位置:网站首页>: 0xC0000005: 写入位置 0x01458000 时发生访问冲突----待解
: 0xC0000005: 写入位置 0x01458000 时发生访问冲突----待解
2022-07-27 14:39:00 【心如琉璃】
`#include <stdio.h>
#include <stdio.h>
#define TOTAL 4 //人员总数
struct {
char name[20];
int num;
char sex;
char profession;
union {
float score;
char course[20];
}sc;
}bodys[TOTAL];
int main()
{
int i; //输入人员信息
for (i =0;i<TOTAL;i++)
{
printf(“Input info:”);
scanf_s("%s %d %c %c", &(bodys[i].name), &(bodys[i].num), &(bodys[i].sex), &(bodys[i].profession));
if (bodys[i].profession ==‘s’)
{
scanf_s("%f", &(bodys[i].sc.score));
}
else
{
scanf_s("%f", &(bodys[i].sc.course));
}
fflush(stdin);
}
//输出人员信息
printf("\nNam\t\tNum\tSex\tProfession\tScore/Course\n");
for (i =0;i<TOTAL;i++)
{
if (bodys[i].profession ==‘s’)
{
printf("%s\t%d\t%c\t%c\t\t%f\n", bodys[i].name, bodys[i].num, bodys[i].sex, bodys[i].profession, bodys[i].sc.score);
}
else
{
printf("%s\t%d\t%c\t%c\t\t%s\n", bodys[i].name, bodys[i].num, bodys[i].sex, bodys[i].profession, bodys[i].sc.course);
}
}
getchar();
return 0;
}`

page ,132
title memset - set sections of memory all to one byte
;***
;memset.asm - set a section of memory to all one byte
;
; Copyright Microsoft Corporation. All rights reserved.
;
;Purpose:
; contains the memset() routine
;
;*******************************************************************************
.xlist
include vcruntime.inc
.list
.xmm
page
;***
;char memset(dst, value, count) - sets “count” bytes at “dst” to “value”
;
;Purpose:
; Sets the first “count” bytes of the memory starting
; at “dst” to the character value “value”.
;
; Algorithm:
; char *
; memset (dst, value, count)
; char dst;
; char value;
; unsigned int count;
; {
; char start = dst;
;
; while (count–)
; dst++ = value;
; return(start);
; }
;
;Entry:
; char dst - pointer to memory to fill with value
; char value - value to put in dst bytes
; int count - number of bytes of dst to fill
;
;Exit:
; returns dst, with filled bytes
;
;Uses:
;
;Exceptions:
;
;**************************************************************************
CODESEG
extrn __isa_available:dword
extrn __isa_enabled:dword
extrn __favor:dword
public memset
memset proc
dst:ptr byte,
value:byte,
count:dword
OPTION PROLOGUE:NONE, EPILOGUE:NONE
.FPO ( 0, 3, 0, 0, 0, 0 )
mov ecx, [esp + 0ch] ; the number of bytes to be set
movzx eax, byte ptr[esp + 08h] ; the value to be stored
mov edx, edi ; saving non-volatile edi
mov edi, [esp + 04h]; the dest pointer
test ecx, ecx; 0 ?
jz toend; if so, nothing to do
imul eax, 01010101h
cmp ecx, 020h; < 32 bytes use SmallMov
jle SmallMov
cmp ecx, 080h; For copies 32 < length < 128
jl XmmMovSmall
bt __favor, __FAVOR_ENFSTRG
jnc XMMMov; no jump
; Enhanced Fast Strings
rep stosb ; store the values in the destination buffer
mov eax, dword ptr[esp + 04h] ; return the original destination pointer
mov edi, edx ; restoring non-volatile edi
ret
; XMM register usage
XMMMov :
bt __isa_enabled, __ISA_AVAILABLE_SSE2
jnc SmallMov ; if yes, use xmm large block set
movd xmm0, eax
pshufd xmm0, xmm0, 0
add ecx, edi ; ecx points to end of buffer
movups [edi], xmm0
add edi, 16 ; point to next xmmword
and edi, -16 ; align xmmword ptr
sub ecx, edi ; ecx is offset to end of buffer
cmp ecx, 080h
jle XmmMovSmall
align 16
LargeRangeBytes :
movdqa [edi], xmm0
movdqa [edi + 010h], xmm0
movdqa [edi + 020h], xmm0
movdqa [edi + 030h], xmm0
movdqa [edi + 040h], xmm0
movdqa [edi + 050h], xmm0
movdqa [edi + 060h], xmm0
movdqa [edi + 070h], xmm0
lea edi, [edi + 080h]
sub ecx, 080h
test ecx, 0FFFFFF00h
jnz LargeRangeBytes
jmp XmmSmallLoop
; Do not require 16-byte alignment for sizes lesser than 128 bytes when using XMM registers
XmmMovSmall :
bt __isa_enabled, __ISA_AVAILABLE_SSE2
jnc SmallMov ; if yes, use xmm large block set
movd xmm0, eax
pshufd xmm0, xmm0, 0
align 16
XmmSmallLoop :
cmp ecx, 32
jb XMMTrailingBytes
MidRangeBytes :
movdqu [edi], xmm0
movdqu [edi + 010h], xmm0
add edi, 020h
sub ecx, 020h
cmp ecx, 32 ; checking number of 32 byte blocks left
jnb MidRangeBytes
test ecx, 01Fh ; check to see if there are bytes left
jz toend
XMMTrailingBytes:
; Remaining bytes written with two stores that may overlap instead of 1 byte at a time
lea edi, [edi + ecx - 020h]
movdqu [edi], xmm0
movdqu [edi + 010h], xmm0
mov eax, dword ptr [esp + 04h] ; return the original destination pointer
mov edi, edx ; restoring non-volatile edi
ret
; Copying less than or equal to 32 bytes
SmallMov:
test ecx, 03h ; check if there are bytes that can be stored
jz DwordTest
ByteLoop:
mov [edi], al
inc edi
sub ecx, 1
test ecx, 03h
jnz ByteLoop
DwordTest:
test ecx, 04h ; checking if there are dword blocks that can be set
jz QwordTest
mov [edi], eax
add edi, 4
sub ecx, 4
QwordTest:
test ecx, 0FFFFFFF8h
jz toend
align 16
QwordLoop:
mov [edi], eax
mov [edi + 04h], eax
add edi, 8
sub ecx, 8
test ecx, 0FFFFFFF8h
jnz QwordLoop
toend:
mov eax, dword ptr[esp + 04h] ; return the original destination pointer
mov edi, edx ; restore non-volatile edi
ret
memset endp
end
边栏推荐
猜你喜欢
![[sword finger offer] interview question 53-i: find the number 1 in the sorted array -- three templates for binary search](/img/4b/460ac517e9a5d840a0961f5d7d8c9d.png)
[sword finger offer] interview question 53-i: find the number 1 in the sorted array -- three templates for binary search

CAS compares the knowledge exchanged, ABA problems, and the process of lock upgrading

低代码是开发的未来吗?浅谈低代码平台

Is the array name the address of the first element?
![[sword finger offer] interview question 49: ugly number](/img/7a/2bc9306578530fbb5ac3b32254676d.png)
[sword finger offer] interview question 49: ugly number

leetcode234题-简单方法判断回文链表

juc包下常用工具类

Addition, deletion, query and modification of MySQL table data
![[sword finger offer] interview question 42: the maximum sum of continuous subarrays -- with 0x80000000 and int_ MIN](/img/01/bbf81cccb47b6351d7265ee4a77c55.png)
[sword finger offer] interview question 42: the maximum sum of continuous subarrays -- with 0x80000000 and int_ MIN

First understanding of structure
随机推荐
C: On function
js操作dom节点
Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
IP protocol of network layer
First understanding of structure
NPM install error unable to access
DRF学习笔记(准备)
Extended log4j supports the automatic deletion of log files according to time division and expired files
The method of exchanging two numbers in C language
C语言:扫雷小游戏
Implementation of spark lazy list files
Go language slow start - Basic built-in types
数据表的约束以及设计、联合查询——8千字攻略+题目练习解答
Mlx90640 infrared thermal imager temperature sensor module development notes (VII)
Is the array name the address of the first element?
The risk of multithreading -- thread safety
[sword finger offer] interview question 41: median in data flow - large and small heap implementation
keil 采用 makefile 实现编译
C language: minesweeping games
Voice live broadcast system -- a necessary means to improve the security of cloud storage