Fuad Efendi
Posts: 1
Nickname: 102910
Registered: Jan, 2017
|
|
Checksum
|
Posted: Jan 16, 2017 8:35 AM
|
|
Advertisement
|
Page 102 of the book (PDF, 3rd edition):
class ChecksumAccumulator {
private var sum = 0
def add(b: Byte): Unit = {
sum += b
}
def checksum(): Int = {
return ~(sum & 0xFF) + 1
}
}
Why is such definition? I believe "checksum" is sum of Words in case of multi-Word representation in computer memory.
Can anyone confirm / explain method above, what it does and why it is called "checksum"? Thanks,
|
|