Compare commits

..

4 Commits
dev ... na5

Author SHA1 Message Date
belfer 36762be158 update 2024-05-16 09:37:39 +00:00
belfer 3a3b7ca003 na 5 2024-05-16 09:30:18 +00:00
belfer 6abe1dfcef poprawiony ptr na ptr1 2024-05-16 09:25:03 +00:00
belfer 172dc1daf6 na ocene 4 2024-05-16 09:21:42 +00:00
1 changed files with 6 additions and 50 deletions

View File

@ -1,7 +1,6 @@
#include <stdint.h>
char * ptr1 = "janek";
char * ptr2 = "kowalskii";
char * ptr1 = "mpabi vlaz";
int strlen(char *s)
{
@ -16,58 +15,15 @@ void strcpy(char *s, char *t)
while (*s++ = *t++);
}
int main() {
#define ALLOCSIZE 10000
char tab [20];
strcpy( tab, ptr1);
static char allocbuf[ALLOCSIZE];
static char *allocp = allocbuf;
uint8_t wynik =0;
wynik = strlen (tab);
char *alloc(int n)
{
if (n % 4 != 0) {
n += 4 - (n % 4);
asm("nop");
}
if (allocbuf + ALLOCSIZE - allocp >= n) {
allocp += n;
return allocp - n;
} else
return 0;
}
int main() {
char * s = "mpabi";
uint8_t wynik =0;
wynik = strlen (s);
asm("nop");
char * p1 = alloc(strlen(ptr1));
strcpy (p1, ptr1);
asm("nop");
char * p2 = alloc(strlen(ptr2));
strcpy (p2, ptr2);
asm("nop");
struct point {
int16_t x;
int16_t y;
};
struct point * ptrS = (struct point *) alloc(sizeof(point));
ptrS->x=0x10;
ptrS->y=0x20;
asm("nop");
(*ptrS).y= strlen (p1)+ strlen(p2);
return 1;
}