mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2026-11-17 18:45:40 +00:00
Add C code alternative to __builtin_popcount.
This commit is contained in:
1 parent
21d7fc58b6
commit
d2ae6a824f
2 files changed
+19
-16
No files matched your search
@@ -21,7 +21,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
#include <intrin.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
@@ -35,19 +34,6 @@
|
||||
|
||||
#define setvbuf msvc_setvbuf
|
||||
|
||||
static inline int __builtin_popcount(unsigned int v)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
while (v)
|
||||
{
|
||||
count += v & 1;
|
||||
v >>= 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline int msvc_setvbuf(
|
||||
FILE* const public_stream,
|
||||
char* const buffer,
|
||||
|
||||
Reference in new issue
Block a user