[Swift] Use nonzeroBitCount when you want popcnt in Swift

As the title says. I was writing a program in Swift that required bit operations for about two weeks, but I didn't notice the existence of this method and grew the extension myself. As per nonzeroBitCount | Apple Developer Documentation, nonzeroBitCount does the equivalent calculation. Probably because of the method name, it was troublesome because I couldn't find it easily even if I searched for "Swift pop cnt" or "Swift bit count". that's all.

Recommended Posts

[Swift] Use nonzeroBitCount when you want popcnt in Swift
When you want to bind InputStream in JDBI3
When you want to use the method outside
When you want to dynamically replace Annotation in Java8
Code to use when you want to process Json with only standard library in Java
Things you often use when doing web development in Java
Delegate is convenient to use when you want to reuse parts
Use JLine when you want to handle keystrokes on the console character by character in Java
Do you use Stream in Java?
ProxyFactory is convenient when you want to test AOP in Spring!
Practice to use when you want to execute different processing groups serially
[Swift] When you want to know if the number of characters in a String matches a certain number ...
[RSpec] When you want to use the instance variable of the controller in the test [assigns is not recommended]
I want to use @Autowired in Servlet
[Swift] If you want to use a URL that includes Japanese, use addingPercentEncoding.
When is it said that you can use try with a Swift error?
You may not want to use the remove method in ArrayList very often
When you want to notify an error somewhere when using graphql-spring-boot in Spring Boot
I want to use arrow notation in Ruby
With Tomcat you can use placeholders ($ {...}) in web.xml
When you get lost in the class name
What do you use when converting to String?
[Ruby] When you want to replace multiple characters
I want to use Combine in UIKit as well.
I want to use a little icon in Rails
If you want to use Mockito with Kotlin, use mockito-kotlin
[Swift] Use UserDefaults to save data in the app
If you want to recreate the instance in cloud9
A memo to check when you try to use Lombok
[Ruby + Rails] When you want to register in Mailchimp's mail list together with user registration
How to write in Model class when you want to save binary data in DB with PlayFramework
When you want to implement Java library testing in Spock with multi-module in Gradle in Android Studio 3
When you want to reflect the Master Branch information in the Current Branch you are currently working on