jeudi 26 juillet 2018

Apply modulo on 74 bits integer

To generate a UFI number, I use a bitset of size 74. To perform the step 2 of the UFI generation, I need to convert this number:

9 444 732 987 799 592 368 290
(10000000000000000000000000000101000001000001010000011101011111100010100010)

in

DFSTTM62QN6DTV1

by applying modulo 31 until 0 on the first representation and get the char equivalence in a table.

#define PAYLOAD_SIZE 74
// payload = binary of 9444732987799592368290
std::bitset<PAYLOAD_SIZE> bs_payload(payload);
/*
perform modulo 31 to obtain:
12(D), 14(F), 24(S), 25(T), 25, 19, 6, 2, 22, 20, 6, 12, 25, 27, 1
*/

Is it exist a way to perform the modulo on my bitset without use an external BigInteger library ?

Aucun commentaire:

Enregistrer un commentaire