Merge remote-tracking branch 'origin/eddie/fix1173' into xc7mux

This commit is contained in:
Eddie Hung 2019-07-09 12:16:33 -07:00
commit bee5d2b21a
2 changed files with 9 additions and 4 deletions

View File

@ -21,13 +21,15 @@
// https://stackoverflow.com/a/46137633
#ifdef _MSC_VER
#include <stdlib.h>
#define __builtin_bswap32 _byteswap_ulong
#define bswap32 _byteswap_ulong
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define __builtin_bswap32 OSSwapInt32
#elif !defined(__GNUC__)
#define bswap32 OSSwapInt32
#elif defined(__GNUC__)
#define bswap32 __builtin_bswap32
#else
#include <cstdint>
inline uint32_t __builtin_bswap32(uint32_t x)
inline static uint32_t bswap32(uint32_t x)
{
// https://stackoverflow.com/a/27796212
register uint32_t value = number_to_be_reversed;

View File

@ -649,10 +649,13 @@ struct TechmapWorker
unique_bit_id[bit] = unique_bit_id_counter++;
}
// Find highest bit set
int bits = 0;
for (int i = 0; i < 32; i++)
if (((unique_bit_id_counter-1) & (1 << i)) != 0)
bits = i;
// Increment index by one to get number of bits
bits++;
if (tpl->avail_parameters.count("\\_TECHMAP_BITS_CONNMAP_"))
parameters["\\_TECHMAP_BITS_CONNMAP_"] = bits;