uint64_t a; uint64_t b; uint64_t a_and_b = a & b; uint64_t a_or_b = a | b; 

How to make a similar for an arbitrary memory area (for example, for uint64_t[n] )? Are there any special OS or assembler commands for this?

ps means something other than traversing the entire memory area in chunks ( uint8_t , uint16_t , etc.) and performing the necessary operation for each piece

  • In general, yes. See SSE / AVX - avp
  • In the sense of? You do not want to write a cycle with your hands and are looking for an instruction that will process the memory block itself without writing a loop explicitly? - AnT
  • Most likely not, because for 9 years with REP prefixes I have only seen string instructions such as SCASB, MOVSB, and so on. - Vladimir Martyanov
  • Write a function with a simple loop and see what the compiler does for different architectures (unroll loops, xmmN / ymmN registers use - this is work for the compiler). - jfs

1 answer 1

Use at least MMX command extension for x86 ( https://ru.wikipedia.org/wiki/MMX ). If your computer has a DSP processor of digital signal processing, then this task is just for him.

  • I for such cases even using __emit__ inserted mmx commands. - nick_n_a