70 lines
951 B
C++
70 lines
951 B
C++
#include <stdint.h>
|
|
|
|
char * ptr1 = "janek";
|
|
char * ptr2 = "kowalskii";
|
|
|
|
int strlen(char *s)
|
|
{
|
|
char *p = s;
|
|
while (*p != '\0')
|
|
p++;
|
|
return p - s;
|
|
}
|
|
|
|
void strcpy(char *s, char *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;
|
|
}
|
|
|
|
int32_t sum (int32_t a, int32_t b) {
|
|
|
|
return a+b;
|
|
}
|
|
|
|
int main() {
|
|
|
|
|
|
struct point {
|
|
int32_t x;
|
|
int32_t y;
|
|
};
|
|
|
|
struct point * ptrS;
|
|
|
|
ptrS = (struct point *) alloc(sizeof(point));
|
|
|
|
asm("nop");
|
|
|
|
ptrS->x=0x10;
|
|
ptrS->y=0x20;
|
|
|
|
int32_t wynik = 0;
|
|
|
|
wynik = sum ( (*ptrS).x, ptrS->y);
|
|
asm("nop");
|
|
|
|
return 1;
|
|
}
|
|
|