Discussion:
A4Q1 Questions
(too old to reply)
Ian Toffelmire
2011-06-26 23:12:10 UTC
Permalink
1. What does "bit fields are reversed" means in terms of what our
program will see when it's reading input? Which bits are reversed? Ex.
In
(110)00010 (10)100011 [where () is the extra bits for UTF8 encoding]
Does it become:
110001(01) 01000(011) [entire character encoding reversed]
(110)11000 (10)101000 [character bits reversed, then encoded]
01000(011) 110001(01) [each 8-bits are reversed]
etc?

2. To generate valid/invalid UTF8 characters, are we simply to use the
"generate UTF8 characters" code and save the result to a linux file?
Will this automatically save it in little-endian format?

3. Are we expected/allowed to use bitset to compare and manipulate
bits, or is there a simpler method for bit manipulation?

Thanks,
Ian
Terry Anderson
2011-06-27 00:56:21 UTC
Permalink
In the future, please refrain from making the same post more than once.

1. See the post I just made to clarify this.

2. Use the provided code and redirect its output to file X. Then you can
use X as input to your utf8 program.

3. The use of bitset is not necessary. You can use the bit field names ck
and dt for bit comparison, e.g. u.t2.ck == 0x6. To manipulate bits, a
simpler method has been described in the course notes (see the
introductory material on C++).

Terry
--
Terry Anderson
CS 246 Instructor
Post by Ian Toffelmire
1. What does "bit fields are reversed" means in terms of what our
program will see when it's reading input? Which bits are reversed? Ex.
In
(110)00010 (10)100011 [where () is the extra bits for UTF8 encoding]
110001(01) 01000(011) [entire character encoding reversed]
(110)11000 (10)101000 [character bits reversed, then encoded]
01000(011) 110001(01) [each 8-bits are reversed]
etc?
2. To generate valid/invalid UTF8 characters, are we simply to use the
"generate UTF8 characters" code and save the result to a linux file?
Will this automatically save it in little-endian format?
3. Are we expected/allowed to use bitset to compare and manipulate
bits, or is there a simpler method for bit manipulation?
Thanks,
Ian
Continue reading on narkive:
Loading...