Sign in to follow this  
Followers 0
ReFran

Bitshift left right problem

10 posts in this topic

Hi,

I need to translate a js example with bitshift left/right.

JS-Script:

var y = (((1 << 14) >> 1) - 1 - 5446);

WScript.echo(y);

the result is 2745.

Thanks in advance

Reinhard

Share this post


Link to post
Share on other sites



BitShift()
doesn't work for you?

(hint ... click the name of the function)


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Try this:

$x = BitShift(BitShift(1, -14), 1) -1 -5446

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Try this:

#cs
JS-Script:
var y = (((1 << 14) >> 1) - 1 - 5446);
WScript.echo(y);

the result is 2745.
#ce

$y = BitShift(BitShift(1, -14), 1) - 1 - 5446
MsgBox(0, "Bitshit", $y)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Ok, so I used $x instead of $y :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

@JLogan3o13: indeed, I did the same thing as you already did...didn't saw your post!

Br,

UEZ :)


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@BlueDrache

... (hint ... click the name of the function)

I did try that, but didn't got the right result.

@JLogan3o13

Many thanks for your help. I searched now tor 3 days how I can show a Yahoo map using Googles Map Api (the zoom factor and the y coord somewho revers). Finaly I found a phyton script which I translated - with some problems - to JS (for use in a html page). Now I want to use it also for my au3 map download tool. I tried already "$n = Bitshift(Bitshift(14,1),-1) -1 -5446", but didn't work correctly. So I thought before I spent further 3 day on a solution, here may be one who can solve it quicker.

So thank you very much for saving time and more endless testing. Works pefect.

@UEZ

Thanks for confirmation.

You are right I will take Y because it's the Y coord ;-)

best regards, Reinhard

Edited by ReFran

Share this post


Link to post
Share on other sites

A simplification (or anti-obscuration) of

BitShift(BitShift(1, -14), 1) - 1 - 5446

is

BitShift(1, -13) - 5447

ConsoleWrite(BitShift(BitShift(1, -14), 1) - 1 - 5446 & @LF)

; BitShift(BitShift(1, -14), 1) - 1 - 5446 = BitShift(1, -13) - 5447

ConsoleWrite(BitShift(1, -13) - 5447 & @LF)

#cs
    @ output console:-
    2745
    2745
#ce

Share this post


Link to post
Share on other sites

Try this:

#cs
JS-Script:
var y = (((1 << 14) >> 1) - 1 - 5446);
WScript.echo(y);

the result is 2745.
#ce

$y = BitShift(BitShift(1, -14), 1) - 1 - 5446
MsgBox(0, "Bitshit", $y)

Br,

UEZ

Lol. "MsgBox(0,"Bitshit",$y)" ... nice typo.
1 person likes this

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

That wasn't a typo... ;)

Br,

UEZ :)


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0