/    Sign up×
Community /Pin to ProfileBookmark

Ok, I found something interesting on the web but I can’t read the code. After trying to replicate the game myself, I’m looking back to his code to see how he might have done something. But still, I find things there unfamiliar ex:

[code=html] for(z=0;z<8;){j[z+8]=j[z]<<=4
m=MV[z++]
if(m){s=m.length
for(x=0;x<s;){m[s+x]=-m[x++]}}}
[/code]

He may be defining array elements but until I can figure out what [B]<<[/B] is doing, it doesn’t yet matter. I don’t know?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Mar 13.2010 — Well, I was going to say that it's a [url=https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Operators/Bitwise_Operators]bitwise operator[/url], but I'm not sure what the equals sign and four are doing there. Could just be a terse bit of code, but it's certainly syntax I'm not used to.
Copy linkTweet thisAlerts:
@jalarieSep 02.2010 — It's the left-shift function.
Copy linkTweet thisAlerts:
@Sterling_IsfineSep 03.2010 — [CODE]
j[z+8] = j[z]<<=4;[/CODE]


Means left shift the value of j[ z ] by four bits then copy it to j[ z+8 ]

Equivalent:
[CODE]j[ z ] <<= 4;

j[ z+8 ] = j[ z ];

[/CODE]


Bitwise Operators
×

Success!

Help @justinbarneskin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...