Compare commits
No commits in common. "na4" and "dev" have entirely different histories.
|
@ -1,6 +1,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
char * ptr1 = " Dominik P";
|
char * ptr1 = "janek";
|
||||||
|
char * ptr2 = "kowalskii";
|
||||||
|
|
||||||
int strlen(char *s)
|
int strlen(char *s)
|
||||||
{
|
{
|
||||||
|
@ -15,13 +16,58 @@ void strcpy(char *s, char *t)
|
||||||
while (*s++ = *t++);
|
while (*s++ = *t++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define ALLOCSIZE 10000
|
||||||
|
|
||||||
|
static char allocbuf[ALLOCSIZE];
|
||||||
|
static char *allocp = allocbuf;
|
||||||
|
|
||||||
|
char *alloc(int n)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (n % 4 != 0) {
|
||||||
|
n += 4 - (n % 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (allocbuf + ALLOCSIZE - allocp >= n) {
|
||||||
|
allocp += n;
|
||||||
|
return allocp - n;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
|
char * s = "mpabi";
|
||||||
|
|
||||||
|
|
||||||
uint8_t wynik =0;
|
uint8_t wynik =0;
|
||||||
wynik = strlen (ptr1);
|
wynik = strlen (s);
|
||||||
|
|
||||||
asm("nop");
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue