Skip to content

Commit cac6dd9

Browse files
committed
tclapi: Use older bignum API and handle external tommath for mac os
1 parent f0704b6 commit cac6dd9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ LIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 -lz -luserenv
449449
else
450450
CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL
451451
LIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo $(TCL_LIBS))
452+
ifneq (,$(findstring TCL_WITH_EXTERNAL_TOMMATH,$(CXXFLAGS)))
453+
LIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libtommath || echo)
454+
endif
452455
endif
453456
endif
454457

kernel/tclapi.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ bool mp_int_to_const(mp_int *a, Const &b, bool is_signed)
210210
}
211211

212212
std::vector<unsigned char> buf;
213-
buf.resize(mp_ubin_size(a));
214-
size_t written; // dummy
215-
mp_to_ubin(a, buf.data(), buf.size(), &written);
213+
buf.resize(mp_unsigned_bin_size(a));
214+
mp_to_unsigned_bin(a, buf.data());
216215

217216
b.bits().reserve(mp_count_bits(a) + is_signed);
218217
for (int i = 0; i < mp_count_bits(a);) {

0 commit comments

Comments
 (0)