BAHAHAHAHAHAHAHAAAAA
This commit is contained in:
6
main.cpp
6
main.cpp
@ -21,14 +21,12 @@ signed main() {
|
|||||||
// It MUST be on the heap
|
// It MUST be on the heap
|
||||||
stacktor<int> * s = new stacktor<int>();
|
stacktor<int> * s = new stacktor<int>();
|
||||||
|
|
||||||
puts("");
|
|
||||||
s->push_back(10);
|
s->push_back(10);
|
||||||
puts("");
|
|
||||||
s->push_back(12);
|
s->push_back(12);
|
||||||
puts("");
|
|
||||||
s->push_back(6);
|
s->push_back(6);
|
||||||
puts("");
|
|
||||||
print_stractor(*s);
|
print_stractor(*s);
|
||||||
|
puts("");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
21
stacktor.hpp
21
stacktor.hpp
@ -25,8 +25,6 @@ private:
|
|||||||
int lock = 0;
|
int lock = 0;
|
||||||
|
|
||||||
void bahaha() {
|
void bahaha() {
|
||||||
int data_size = sizeof(T);
|
|
||||||
|
|
||||||
asm (
|
asm (
|
||||||
"movq %%rsp, %0;"
|
"movq %%rsp, %0;"
|
||||||
: "=r" (data)
|
: "=r" (data)
|
||||||
@ -34,18 +32,15 @@ private:
|
|||||||
:
|
:
|
||||||
);
|
);
|
||||||
|
|
||||||
goto pass;
|
while (not lock);
|
||||||
|
|
||||||
start:
|
this->god_have_mercy();
|
||||||
asm volatile (
|
}
|
||||||
"sub %%rsp, %0;"
|
|
||||||
:
|
void god_have_mercy() {
|
||||||
: "" (data_size)
|
T prayers;
|
||||||
);
|
--lock;
|
||||||
DEBUG_PRINT("Element allocated.");
|
|
||||||
--lock;
|
|
||||||
|
|
||||||
pass:
|
|
||||||
DEBUG_PRINT("Locking.");
|
DEBUG_PRINT("Locking.");
|
||||||
while (not lock) {
|
while (not lock) {
|
||||||
if (request != -1) {
|
if (request != -1) {
|
||||||
@ -62,7 +57,7 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto start;
|
this->god_have_mercy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user