473,659 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compute the number of words needed?

In a compiler there are 36bits for a word and to store a character
8bits are needed. In this to store a character two words appended.
Then for storing k characters string,how many words are needed?

Jul 16 '07 #1
4 2078
sumedh..... wrote On 07/16/07 10:34,:
In a compiler there are 36bits for a word and to store a character
8bits are needed. In this to store a character two words appended.
Then for storing k characters string,how many words are needed?
What is a "word?" Before answering, observe that
it cannot be an int or long or any other C data type.
(Every C object can be viewed and manipulated as an
array of bytes; your four-and-a-half-byte "word" does
not meet that criterion.)

--
Er*********@sun .com
Jul 16 '07 #2
"sumedh.... ." <su**********@g mail.comwrote:
In a compiler there are 36bits for a word and to store a character
8bits are needed.
This is possible.
In this to store a character two words appended.
This is ungrammatical, and without meaning.
Then for storing k characters string,how many words are needed?
This is homework. Do it yourself.

Richard
Jul 16 '07 #3
sumedh..... wrote:
In a compiler there are 36bits for a word and to store a character
8bits are needed. In this to store a character two words appended.
Then for storing k characters string,how many words are needed?
I suppose this is homework, so it's probably a good thing that the
question is not stated clearly. In particular, it is underspecified.
Suppose that you have 10 bytes to recover. These can be in 9 bytes in
one conjoined 72-bit chunk + 1 more byte. Must you retrieve two words
(a 72-bit bit chunk) for that last byte, or can you do it with only one
more 36-bit word? The answer in this case could be either 3 or 4 words.

Let's consider some real-life cases.
The major 36-bit word machines I have used are in the IBM 7090/7094, DEC
PDP-6/PDP-10, and GE 635/645 families. In all of these, addressing of
bytes had to be to groups of contiguous bits within a word. That meant
that the world you seem to be concerned with did not obtain: two
contiguous 36-bit words could not be treated as one 72-word for purposes
of byte addressing. Hoe, then, does one handle bytes.

In the GE 635/645 case, a common answer was to use 9-bit bytes. This
meant one could have a 512 character character set, or 256 characters
with a bit used as a flag of some sort, or just a wasted bit per char.

In the PDP 6/PDP-10 case, where a byte pointer stored the base word
address, the size of a byte (1-36 bits) and the position of the next
byte (relative to the end of the word), the normal choices were
a) 6x6-bit bytes, inappropriate for C, but useful in situations
where case sensitivity was not needed
a') an even more restricted set of 40 characters (RAD50) which were
rarely interpreted, but rather an encoded word was created and
used in symbol tables. much as a password look up table.
b) 5x7-bit bytes, with the last bit either wasted of used as a
flag. Inappropriate for C, but capable of handling ASCII text.
c) 4x8-bit bytes, with 4 bits either wasted or used as a set of
flags. C chars can be accommodated within this scheme, but attempts
to fit this into a coherent integer type system can be tricky.
d) 4x9-bit bytes, as in the GE 635/645 case. This accommodates C chars
nicely, and because the PDP-6/PDP-10 series have instructions for
retrieving and storing either the right or left hand 18-bits of a
word separately, it is trivial to implement using the basic
instruction set for the machine a type system including
9-bit chars
18-bit shorts
36-bit int
and, if you choose to make ints and longs different lengths,
72-bit longs can be added at small cost in computation.
Jul 16 '07 #4
"sumedh.... ." wrote:
>
In a compiler there are 36bits for a word and to store a character
8bits are needed. In this to store a character two words appended.
Then for storing k characters string,how many words are needed?
AFAIK, it's up to the implementation.

I used a 36-bit word system (DEC KL-10), back in college, but this was
before I started programming in C. On that platform, the Fortran
compiler would store text as five 7-bit characters per 36-bit word,
with one bit wasted. (Filenames were six 6-bit characters, equivalent
to ASCII range 0x20 through 0x5F offset by 0x20.)

I don't think a C compiler could do that, as I seem to recall that
CHAR_BITS must be at least 8. However, it could store four 8-bit
characters, wasting 4 bits per word. It could also store one 8-bit
character per word, wasting 28 bits. Or, it could do anything in
between. Perhaps it would store four 9-bit chars per word?

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer .h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th***** ********@gmail. com>

Jul 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
5868
by: Dick Moores | last post by:
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, <http://mathworld.wolfram.com/Base.html>, but I really don't understand it well enough. Could someone show me how to do what I need? Thanks, Dick Moores rdm@rcblue.com
1
2282
by: rock72 | last post by:
I am developing a application using this fields as required by the company. 1. Date Login 2. Time IN 3. Time OUT My question is how to produce the number of days with 1 entry of Date is the entry ?
4
6273
by: PengYu.UT | last post by:
Hi All, For example, I want to declare an array double array; Of cause, I can define an macro for the 4th power of VERY_VERY_VERY_LONG_NAME. But I want to know whether there is any build in macro to compute the powers. Thanks!
40
2800
by: RadiationX | last post by:
I have a problem that I really don't understand at all. In my previous post I could get started on my projects I just had a few problems with syntax errors. This problem is something that I don't conceptually understand very well. Here it is: Π – the ratio of the circumference of a circle to its diameter – is one of the most common and important constants in mathematics. It is an irrational number (a real number that cannot be...
22
4877
by: MLH | last post by:
If 3 things can be in one of 2 states, the number of possible combinations is equal to 2^3. But if I have 3 things, 2 of which can be in 2 states and the other in 3 states, what's the simplest expression that will accurately compute the permutationjs possible?
1
1482
by: dharnE | last post by:
I'm Hoping that this Problem will answer.The Problem is"Create A Program to compute the pay of employees as entered by the user using function statement" Sample Output: Enter Number of Employees:3 Hours:50 Rate:5.25 Pays:262.50 ------------------------------ Hours:6 Rate:5.00 Pays:30.00 ------------------------------
5
4581
by: gracia | last post by:
I need to compute the value of binomial(n, k)=n!/k!(n-k)! * (1-p)^n * p^k. When n and k is very big (e.g. n 160), the step to compute n!/k!(n- k)! is always overflow even when I used unsigned long long. Can anyone help me? Thank you
6
3532
by: W. eWatson | last post by:
That's the question in Subject. For example, the difference between 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in years between, say, 1990 and 2050. In other words not some really strange period of time well outside our current era of history. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
8
4724
by: remlostime | last post by:
i use g++ to generater rand number, now i find that the RAND_MAX is 32367 in my computer, how can i make a bigger rand number( the number is wihin in the integer(2^32-1))
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.