Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

circular shift

Name: Anonymous 2016-05-06 7:01

why don't most high level programming languages have a circular bitwise shift instructions given that most of the processors have it? why do I have to write a stupid one-liner that isn't guaranteed to be portable to have a compiler convert it to a single assembler instruction? it should be the other way around: write a single instruction and if processor doesn't support it, the compiler would convert it to an assembly workaround.

I know it's minor shit but that's also why there's no excuse for that

Name: Anonymous 2016-05-06 7:37

>>1
AUTISM DETECTED:
Designers of compilers are not catering to asm programmers.
You're supposed to use intrinsic/built-in function for the rarely used stuff(which they felt doesn't justify wasting an operator on).

Name: Anonymous 2016-05-06 7:43

>>2
intrinsics are not portable

Name: Anonymous 2016-05-06 8:03

Name: Anonymous 2016-05-06 8:13

>>4
well no shit sherlock, I'd be impressed if they came up with something less portable than asm

Name: Anonymous 2016-05-06 8:28

>>5
Intel model specific microcode(used in updates)

Name: Anonymous 2016-05-06 11:32

because the whole idea behind high level(tm) languages is to avoid machine instructions and use high level constructs.

Name: Anonymous 2016-05-06 11:50

>>7
but bitwise operations in general alre available so why is this one an exception? if we removed high-level rotates,why don't we also remove high-level xor?

Name: Anonymous 2016-05-06 12:13

>>8
the availability of bitwise ops is a design flaw.

Name: Anonymous 2016-05-06 12:48

>>9
try handling binary protocols without them. or writing crypto code. inb4 use assembler for thar

Name: Anonymous 2016-05-06 12:56

>>1
I actually have wondered this myself. Maybe C was developed before CPUs generally had these instructions?

BTW, check em.

Name: Anonymous 2016-05-06 15:32

With the bit-banging I've done for serialization, compression, and bitwise math, all I want is ready access to the carry flag. Why is that always nonexistent‽

Name: Anonymous 2016-05-06 15:42

Name: Anonymous 2016-05-06 16:23

1
high level programming languages
instructions

What did he mean by this?

>>11
http://www.mathemainzel.info/files/x86asmref.html
ROR - Rotate Right

Name: Anonymous 2016-05-06 17:57

>>10
Bitwise ops can be replaced with usual arithmetic operators, making code less cryptic and accessible to wider audience.

Name: Anonymous 2016-05-06 18:08

>>15
That's not a goal to strive for.

Name: Anonymous 2016-05-06 18:27

>>16
"Programs must be written for people to read, and only incidentally for machines to execute." --Hal Abelson

Name: Anonymous 2016-05-06 18:49

>>15
>>16
So? It's commonly done, though. n * sizeof(s) instead of n << log2(sizeof(s)). Similiarly with & and %. You write modulo because it's simply more readable, both compile to same thing (of course assuming power of 2 operand).

As for why there are no operators for obscure instructions like rotl, bswap, xlat, it's mainly because c was designed on/inspired by PDP7 in the 70s, not an 80286 in 2016.

To be frank, I'm more worried of the sorry state of x86 SIMD rotates, where you're simply forced to use four instructions - copy/shift/shift/or - no matter if it's hand written asm, or code generated by vectorizer, both compiles to the same crap (this was fixed only very recently, in AVX2).

Name: Anonymous 2016-05-07 0:57

Add bitfield insert and extract while you're at it.

Name: Anonymous 2016-05-07 10:57

>>17
For qualified people to read, not for Hindus.

Name: Anonymous 2016-05-08 20:33

>>18
Optimise your quotes, 「下さい」

Name: Anonymous 2016-05-12 15:21

check'd

Name: Anonymous 2016-05-12 22:14

>>20
import qualified People from India

Name: Anonymous 2016-05-12 23:27

>>23
Won't compile, obviously.

,'''( °ں)

Don't change these.
Name: Email:
Entire Thread Thread List