0

Is it possible to define function(x) multiple times but random size at compile time? For example, we have

#define stuff() __asm __emit(0x00)

but I want it to repeat several times like from 1 to 5

stuff()
stuff()
stuff()
stuff()
stuff()

Is it possible to forget about hardcoding and leave it to compiller? Also I found code that represents random at compile time:

#define UL unsigned long
#define znew  ((z=36969*(z&65535)+(z>>16))<<16)
#define wnew  ((w=18000*(w&65535)+(w>>16))&65535)
#define MWC   (znew+wnew)
#define SHR3  (jsr=(jsr=(jsr=jsr^(jsr<<17))^(jsr>>13))^(jsr<<5))
#define CONG  (jcong=69069*jcong+1234567)
#define KISS  ((MWC^CONG)+SHR3)
/*  Global static variables:
    (the seed changes on every minute) */
static UL z = 362436069 * (int)__TIMESTAMP__, w = 521288629 * (int)__TIMESTAMP__, \
jsr = 123456789 * (int)__TIMESTAMP__, jcong = 380116160 * (int)__TIMESTAMP__;
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user2173645
  • 141
  • 1
  • 7
  • *"Is it possible to define function(x) multiple times"* Not usually. C++ has a one definition rule. Perhaps I'm not understanding what you're asking? –  Mar 21 '20 at 16:28
  • Seems like an X-Y problem. Why do you want this? – GManNickG Mar 21 '20 at 16:29
  • runtime code should look like 0x00 0x00 0x00... etc (from stuff() definition) but it's not good to write: stuff(); stuff(); stuff();... – user2173645 Mar 21 '20 at 16:30
  • I need to allocate space in binary that info will be changed later to insert data inside. But it's importaint to have low file size so it's not effective to just allocate big space – user2173645 Mar 21 '20 at 16:38

0 Answers0