Home
Level Extreme platform
Subscription
Corporate profile
Products & Services
Login
FRANÇAIS
Home
FRANÇAIS
Level Extreme platform
Login
Best practices
Testimonials
Downloads
Articles
Subscription
Subscribe or renew
Benefits
Donate 5$
Donate 10$
Donate 15$
Donate 20$
Donate 25$
Corporate profile
Overview
Portfolio
Products & Services
Consulting services
Enterprise hosting
Web Site Hosting
Graphic design
Book publishing
Support
Troubleshooting
Problem with logins
Contact us
Legal
Copyright
Privacy policy
Terms & Conditions
Français
Bitcount
Message
From
04/12/2014 01:49:05
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden
,
Germany
To
04/12/2014 01:44:48
Gregory Adam
Belgium
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re:
Bitcount
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
SAMBA Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01611745
Message ID:
01611748
Views:
52
>>Hi all,
>>
>>Problem is I need to do do something as a multipple of the bits set on an integer, the integer is a bit array to store statii.
>>
>>I need to figure out how many bits are set on an integer.
>>
>>I know I can loop / iterate through the number and bittest / divide by 2 etc.
>>
>>for now there are not to much so I can do with an ICASE, but I like it generic :)
>>
>>Any ideas for a fast solution? Something mathematical?
>>
>>Lutz
>
http://stackoverflow.com/questions/109023/how-to-count-the-number-of-set-bits-in-a-32-bit-integer
>
http://en.wikipedia.org/wiki/Hamming_weight
>
http://gurmeet.net/puzzles/fast-bit-counting-routines/
>
>- you may have to bitor(intermediateResults, 0) to force them back into a 32 bit integer
>- Test also negative numbers.
WOW
Thanks
>> shift right or does it rotate?
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
Off
There is no place like [::1]
Previous
Next
Reply
Map
View the map of this thread
View the map of this thread starting from this message only
View
View all messages of this thread
View all messages of this thread starting from this message only
Click here to load this message in the networking platform
Level Extreme platform
Best practices
Testimonials
Downloads
Articles
Subscription
Subscribe or renew
Benefits
Donate 5$
Donate 10$
Donate 15$
Donate 20$
Donate 25$
Corporate profile
Overview
Portfolio
Products & Services
Consulting services
Enterprise hosting
Web Site Hosting
Graphic design
Book publishing
Support
Troubleshooting
Problem with logins
Contact us
Legal
Copyright
Privacy policy
Terms & Conditions
Login
Google
Copyright © 1993-2024 by Level Extreme Inc. All rights reserved · Website by
levelextreme.com