admin管理员组文章数量:1321597
im writing a free tool for SEO... implementing an api from seomoz and the flags look like this
URL Metric,Bit Flag
Title,1
URL,4
Subdomain,8
Root Domain,16
External Links,32
Links,2048
mozRank,16384
mozTrust,131072
these are just a few but i dont know how to calculate the proper bit flag in javascript... is it just an OR of all the integers of the flags i want to use? a small snippet to show me how to make a var that holds some of these flags would be awesome...
thanks for your help!
im writing a free tool for SEO... implementing an api from seomoz and the flags look like this
URL Metric,Bit Flag
Title,1
URL,4
Subdomain,8
Root Domain,16
External Links,32
Links,2048
mozRank,16384
mozTrust,131072
these are just a few but i dont know how to calculate the proper bit flag in javascript... is it just an OR of all the integers of the flags i want to use? a small snippet to show me how to make a var that holds some of these flags would be awesome...
thanks for your help!
Share Improve this question asked Jan 31, 2010 at 16:49 Carter ColeCarter Cole 9249 silver badges16 bronze badges2 Answers
Reset to default 6Just like in C:
var flags = 0;
// *snip*
flags |= MyFlag;
flags |= MyOtherFlag;
// *snip*
if ((flags & MyFlag) == MyFlag)
{
// do stuff
}
is it just an OR of all the integers of the flags i want to use?
Yes. Title|URL|Links
(etc.) would be 1|4|2048
本文标签: bitflagsHow to calculate Bit Flag in javascriptStack Overflow
版权声明:本文标题:bitflags - How to calculate Bit Flag in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742102223a2420853.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论