## litecoin – How to convert diiff to bits and bits to diff?

For BTC exist such code (from cgminer):

static uint8_t diff_to_bits(double diff)
{
uint64_t diff64;
uint8_t i;

``````diff /= 0.9999847412109375;
diff *= (double)2147483648.0;
if (diff > 0x8000000000000000ULL)
diff = 0x8000000000000000ULL;
/* Convert it to an integer */
diff64 = diff;
for (i = 0; diff64; i++, diff64 >>= 1);

return i;
``````

}

static double bits_to_diff(uint8_t bits)
{
double ret = 1.0;

``````if (likely(bits > 32))
ret *= 1ull << (bits - 32);
else if (unlikely(bits < 32))
ret /= 1ull << (32 - bits);
return ret;
``````

}

How to adapt this code to Litecoin?

Thanks!

## c – Read certain bits from one register and write into certain bits of another

I am looking to implement the prototype for read_and_write, but couldn’t get it right. Any help is appreciated. I am able to extract bits.

In this below code for write_val1, my intent is to write only the first 9 bits of final_val into read_data. The rest 7 bits of read_data should remain untouched. Expected output for write_val1 = 0x0080

Similarly for write_val2, my intent is to write only next 8 bits from final_val into read_data. The rest 8 bits of read_data should remain untouched. Expected output for write_val2 = 0x2700

Similarly for write_val3, my intent is to write only next 3 bits(010) from final_val into a position(11:13) of read_data leaving rest of read_data untouched.

Expected output = 0x5448 ; For example: pick 010 extracted bit from
write_val3; 0x3048 = 0111 0000 0100 1000; 0x5048 = 0101 0000 0100 1000

``````#include <stdio.h>
#include <stdint.h>

// Extracts n bits from a given position in LSB.
int bitExtracted(uint16_t read_data, uint8_t n_bits, uint8_t pos)
{
return (((1 << n_bits) - 1) & (read_data >> (pos - 1)));
}

void read_and_write(uint32_t* final_val, uint16_t* write_val, uint8_t start_pos, uint8_t end_pos)
{
uint32_t temp = *final_val;
*write_val = (uint16_t) ((temp >> start_pos) & ((1 << end_pos) - 1)); // store the desired number of bits in write_val
*final_val = (temp >> end_pos); //shift final_val by end_pos since those bits are already written
printf("n temp %x, write_val %x, final_val %x ", temp, *write_val, *final_val);

}

void main()
{
uint32_t final_val = 0x0; //Stores 20 extracted bits from val1, val2 and val3 into final_val (LSB to MSB in order)
uint16_t write_val1, write_val2, write_val3;
uint8_t start_pos = 0, end_pos =8;
ext_val1 = 0x80, ext_val2 = 0x0, ext_val3 = 0x2;
final_val = (ext_val1 | (ext_val2 << 9) | (ext_val3 << 17));
printf ("n final_val %x", final_val);

//Read first 9 bits of final_val and write only into (8:0) position of existing read_data

//Read next 8 bits of final_val and write only into (7:0) position of existing read_data
start_pos = 0;
end_pos = 7;

//Read next 3 bits of final_val and write only into(13:11) position of existing read_data
start_pos = 11;
end_pos = 13;
printf ("n val1 0x%x val2 0x%x val3 0x%x final_val 0x%x", write_val1, write_val2, ext_val3, final_val);
}
``````

## time complexity – Determining the number of iterations needed to find the number of bits in an integer

I’m trying to understand the complexity/number of iterations needed to determine the number of bits in an integer.

``````4 = 100  =  3 bits
3 = 011  =  2 bits
8 = 1000 =  4 bits
``````

I skimmed through this article and it says: `A positive integer n has b bits when 2^b-1 ≤ n ≤ 2^b – 1`

But when you do the math for an integer 4, you get `2.32 ~= 2`. What am I doing wrong?

## Bits Gain – Bits-gain.com

Start: September, 16 2020

Bits Gain

QUOTE

Bits Gain is an investment firm focused exclusively on ventures, tokens, and projects related to blockchain tech, digital currency, and crypto assets. Our mission is to act as the catalyst for widespread blockchain adoption and innovation. Exclusively focused on investing in blockchain technologies, the Bits Gain team is experienced in both traditional finance and emergent blockchain technology. Cloud mining or cloud hashing is a concept, which allows users to buy mining power of the hardware placed in remote data centers. Some mining companies had to close because of low Bitcoin price but our company successfully passed this period and now with growth of Bitcoin price we are able to make good profit for investors around the world – anyone can join us and get stable source of income.

Investment plans:

10% Daily For 15 Days
150% Total Profit
\$1.00 – \$500.00

12.5% Daily For 15 Days
187.5% Total Profit
\$501.00 – \$1000.00

15% Daily For 12 Days
180% Total Profit
\$1001.00 – \$5000.00

17% Daily For 12 Days
204% Total Profit
\$5001.00 – \$10000.00

Min deposit: 1\$

Max deposit: 10000\$

Refferal: 5-2%

Pay. systems: Perfect Money, Payeer, Bitcoin, Bitcoin Cash, Ethereum, Litecoin, Doge

Gold Coders Script

DDOS Protection

SSL Certificate

QUOTE

bits-gain.com resolves to 199.188.200.254
The certificate should be trusted by all major web browsers (all the correct intermediate certificates are installed).
The certificate was issued by Sectigo.
The certificate will expire in 243 days.
The hostname (bits-gain.com) is correctly listed in the certificate.

Whois

QUOTE

Domain name bits-gain.com
Registrar WHOIS Server whois.namecheap.com
Updated Date 0001-01-01T00:00:00.00Z
Creation Date 2020-05-17T12:27:18.00Z
Registrar Registration Expiration Date 2021-05-17T12:27:18.00Z
Name Server dns1.namecheaphosting.com
Name Server dns2.namecheaphosting.com

Check and register

Deposit
\$ 100.00 Sep-16-2020 04:28:29 AM Deposit
Add funds to account from PerfectMoney. Batch id = 334616036
Batch: 334616036
Compound: 0%.

Very fast withdrawal
Hello.
\$10.00 has been successfully sent to your PerfectMoney account.
Transaction batch is 334632790.
Bits-Gain.com

## Bits Gain – Bits-gain.com – HYIPs

Start: September, 16 2020

Bits Gain

Bits Gain is an investment firm focused exclusively on ventures, tokens, and projects related to blockchain tech, digital currency, and crypto assets. Our mission is to act as the catalyst for widespread blockchain adoption and innovation. Exclusively focused on investing in blockchain technologies, the Bits Gain team is experienced in both traditional finance and emergent blockchain technology. Cloud mining or cloud hashing is a concept, which allows users to buy mining power of the hardware placed in remote data centers. Some mining companies had to close because of low Bitcoin price but our company successfully passed this period and now with growth of Bitcoin price we are able to make good profit for investors around the world – anyone can join us and get stable source of income.

Investment plans:

10% Daily For 15 Days
150% Total Profit
\$1.00 – \$500.00

12.5% Daily For 15 Days
187.5% Total Profit
\$501.00 – \$1000.00

15% Daily For 12 Days
180% Total Profit
\$1001.00 – \$5000.00

17% Daily For 12 Days
204% Total Profit
\$5001.00 – \$10000.00

Min deposit: 1\$

Max deposit: 10000\$

Refferal: 5-2%

Pay. systems: Perfect Money, Payeer, Bitcoin, Bitcoin Cash, Ethereum, Litecoin, Doge

Gold Coders Script

DDOS Protection

SSL Certificate

bits-gain.com resolves to 199.188.200.254

The certificate should be trusted by all major web browsers (all the correct intermediate certificates are installed).
The certificate was issued by Sectigo.
The certificate will expire in 243 days.
The hostname (bits-gain.com) is correctly listed in the certificate.

Whois

Domain name  bits-gain.com

Registrar WHOIS Server  whois.namecheap.com
Updated Date  0001-01-01T00:00:00.00Z
Creation Date  2020-05-17T12:27:18.00Z
Registrar Registration Expiration Date  2021-05-17T12:27:18.00Z
Name Server  dns1.namecheaphosting.com
Name Server  dns2.namecheaphosting.com

Check and register

Deposit
\$ 100.00    Sep-16-2020 04:28:29 AM    Deposit
Add funds to account from PerfectMoney. Batch id = 334616036
Batch: 334616036
Compound: 0%.

Very fast withdrawal
Hello.
\$10.00 has been successfully sent to your PerfectMoney account.
Transaction batch is 334632790.
Bits-Gain.com

## Bits Boss – bitsboss.com – HYIPs

Start 2020-08-11. PerfectMoney verified, 3.4 Trust Score point(s) (Egypt ), Payeer, Bitcoin, Ethereum, Litecoin

Languages: EN

Description:

Bits Boss adept standard focuses on the profoundly maintained crypto mining farms and several seasoned crypto trading routines including strategies over multiple Exchanges and markets.

Investment plans:

8-10% daily forever

Our deposit:

11.08.20 08:58     Transfer     Sent Payment: 60.00 USD to account U10560048 from U1294xxx. Batch: 328470010. Memo: Shopping Cart Payment. Deposit to Bits Boss User allhyips.

Details:

Minimal deposit: \$20
Maximal deposit: \$50000
Referral comission: 7%
Payments: Manual
Features: SSL,DDOS,Original script

Whois:

Registrar    NAMECHEAP INC NameCheap, Inc.

Dates    4 days old
Created on 2020-08-07
Expires on 2021-08-07
Updated on 0000-12-31

Name Servers
NS1.DDOS-GUARD.NET (has 4,732 domains)
NS2.DDOS-GUARD.NET (has 4,732 domains)
NS3.DDOS-GUARD.NET (has 4,732 domains)
NS4.DDOS-GUARD.NET (has 4,732 domains)
NS5.DDOS-GUARD.NET (has 4,732 domains)
NS6.DDOS-GUARD.NET (has 4,732 domains)

## What is the distribution of the digit sums of the periodic bits of the decimal expansions of the fractions 1/n?

someone not specifically mathematically trained just related this they heard:

Take all the fractions of the form 1/d with integers d. Select the ones that have periodic decimal expansion. Take the periodic bits and for each calculate the sum of digits.

They claim the distribution of these sums is somewhat unusual or interesting

Having no idea myself but good reason to be procrastinating (I swear!) I made an experiment in Python (rough code here) and behold, the distribution does look odd:

Can someone explain what is going on here?

## Bits Boss – Bitsboss.com

Start 2020-08-11. PerfectMoney verified, 3.4 Trust Score point(s) (Egypt ), Payeer, Bitcoin, Ethereum, Litecoin

Languages: EN

Description:

QUOTE

Bits Boss adept standard focuses on the profoundly maintained crypto mining farms and several seasoned crypto trading routines including strategies over multiple Exchanges and markets.

Investment plans:

8-10% daily forever

Our deposit:

11.08.20 08:58 Transfer Sent Payment: 60.00 USD to account U10560048 from U1294xxx. Batch: 328470010. Memo: Shopping Cart Payment. Deposit to Bits Boss User allhyips.

Details:

Minimal deposit: \$20
Maximal deposit: \$50000
Referral comission: 7%
Payments: Manual
Features: SSL,DDOS,Original script

Whois:

Registrar NAMECHEAP INC NameCheap, Inc.

Dates 4 days old
Created on 2020-08-07
Expires on 2021-08-07
Updated on 0000-12-31

Name Servers
NS1.DDOS-GUARD.NET (has 4,732 domains)
NS2.DDOS-GUARD.NET (has 4,732 domains)
NS3.DDOS-GUARD.NET (has 4,732 domains)
NS4.DDOS-GUARD.NET (has 4,732 domains)
NS5.DDOS-GUARD.NET (has 4,732 domains)
NS6.DDOS-GUARD.NET (has 4,732 domains)

## How do you convert bits into a different alphabet?

I have forgotten how to do this. How do I figure out what the requirements are for a 128-bit string using a certain alphabet?

That is to say, I want to generate a UUID (128-bit) value, using only the 10 numbers for the alphabet. How many numbers do I need, and what is the general equation so I can figure this out for any alphabet of any size?

What is the equation for any n-bit value with any x-letter alphabet?

The way I do it is to guess and slowly iterate until I arrive at a close number. For powers of 10 it’s easy:

``````Math.pow(2, 128)
3.402823669209385e+38
Math.pow(10, 39)
1e+39
``````

For other numbers, it takes a little more guessing. Would love to know the equation for this.

## computer architecture – How can I get 8 bits output from 4 bit CPU?

I am very new to Computer architecture. I am thinking to add one more output register to this 4 bit CPU as shown below. However, I am not sure should I connect the output register to the current CPU. Should I connect it just the same way as the current one and label the 2 output register as output A and output B? But if I connect it the same way, the input data from ALU to output registers will always be only 4 bits, how should I get 8 bits output from the two output registers?