ECSE 221 - Fall 2004 solutions

ECSE 221 - Fall 2004 solutions - Egkfi‘” :5 fig...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Egkfi‘” :5 fig yfggéwkvm’xfimfi y. gag» V“! Wfi‘. w: Wéa \w; @Efi “3&5ng \flfim/W m gum m WM; Wfisk M? 5h “i :3 \w-‘Qx > §,§§m§¥§m£$$ M. :3 a W: yumwgagg WET “‘6 a}? My“ ‘mfifinfiln’ we; MW” 3% mg“ Wk Q‘M§ mgghgfi $ WWVVVV wt?) fiafiufifii‘ “5* 9 2., :2: wwlhign : mfiyfizfimlk .5. E “L 7.2.... $3 xwmfimflfl :: w,“§l§%m~w% v? E}; 2m» m. Q“ L {gmmmfig b,%i%§$??é 4“ is” 2. l u.%§%g§¥% ’3: mrb’in—Em‘at Jr Eu. “1.. “2.. aim-$343513 b.2‘33“?§m% A? § 3 2,. {b.QSSQEMQ 3 afimgamg A. 53W 2“ ‘2». gamma“: Qfifik¥$¢2£n§§§ "66L 2. L . V. (3 Wk Lg “:7. C‘Efi‘ggfiw‘i’figm g; é {gibmg 3;... “2% mm “*3 $3“ $3 Qfiméug gkmwm} wfiw mfiwammkmg ma MW gawk—imagk QWA’ {gmdéfk' 315M» gruclfimél 9w? 3e?wsmk£i~3 M?) gfisfi“) m3€§a§§ 1?: fifimgzfim 4%}; “2* .3” m“ w: fig“. {1:5 ‘3» E: QW‘EQW 2:: mfg???“ m ‘3 EX {4.3%13 *2: wiMQ “9‘ m Q... 1. % i», 3 mfg? E“ {‘fi’ékfif 63‘? m 35%;? y § fix Ti mas-1g? 31’ "g. Q “E... Em SgWKm mwz figwig E 23% $2; {ix "3; ‘ %§ 'fg— S" Fme Wfi H 3: {:5} wig fig?“ E :3 B— Lémkhx W? 5; wt EaR’i Hmawwimimi m§ QM; firmgifimmg {firmfk (gaMA ME; Mfiaffi) xi» 3% 3:- ‘3 a, “W; vfiam QW?QW3V M fixi‘fc’fs 3 - R??? {\wlfiqivflfi , § m T$H1$ m §® ‘ ‘2 WEJfi m ‘3 §%%$%Q~§E~ m 2L§§”Z$§~E&+Z m. {Ema} H i EQEN §ak§amrg & 3f: i: mwax mm 1; gfim“§?‘$ mag) HM @(zmm mktal‘x m Rx 1”» raga: €3§Q~ mm:wa macawa’k AM «he W¥V€w 33% CW; Mmfimgflfl ’ 3 mgmmg 3, $34 of firk ghmkwm m 2mm mam t3me mama mwa mama ma‘fiw “mafi :23; 4x ‘; fiinclude qgtdlibeh> /* includes */ wfl?%wL xfigjf§§ fingjfiw mkrfw *%§W~ owKQW #include <stdio.h> /* includes *f . fig“ ${ ‘ / R w; ‘ yaw } MAY $5 33m 1 jaw» W's“ James“ $53M”? W 532;! 3%. Amxéw WWW gm \. mm ig‘ngdamx :Kq . W‘“ “‘3‘” int multigly [int multiplier, int multiplicand}; int argl, argz; fir mv¥. fiA u%%* QNAA if; :53: WK ‘we a 3”” W int *result; Skéfixfi %RL $WWX%J§L€1 f6§:§\%- wag print§("%i * %i = %i",argl,arg2,mu2t1ply(argl,argQ}); %L&- gmwg 8“”\iflm fifflafifi § Ldfi myfi‘ anw n: multiply {int multiplier, int multiplicand) i @Emkfii’g €§ “NH r"-\ H in: chk_bit; fix ax Chk bit = multiplier&0x000®8000; ‘%5 “ flaw if {chkmbitszxQDDOBDDO) multiplier : multiplierEOxFEFFOOOO; Chk bi: ll multiplicand&0x00008000; if (Chk bit228x00088000} multiplicand x multiplicand GXFFFFuooa; int imD; int partial product; int in: result = O; whileCi<32) { Chkmbit : multiplier&0x00000001g if (chk_bit==0x00000000) partialmpraduct x 0; else partialmproduct : multiplicand; intwresult = int_result + partialwpruductg if (multiplier x2 1} ii=32; alga { iZi-i—l; multiplic&nd : multiplicand <<lg multiplier = multiplier >> 1; } returniint_result); C;\22lwassl\lcc\mui:ipiy.c {fl Ebb [iii 1 October 18, 2004 Q6 PLA Please hand in with your exam bucklet. Name: Student Number: clan-3.1: : k1+EUL€5+ E-XLrM-L‘) : (BC. + 12354.- LE +75- >LPT+EJELE 1 LB“ *Ev‘fl[fi Haw) *- TIELJL-Efia- am 93.34.3143 Q ,, ,, .. ,, . . >>>>>>>>>>>>>>>>>>>>>>> H > f H a £3 at; § {3 i ii} (:33 § {3 ‘1 Q a w % § :3 E {3 E $ 1} if; E ‘ G ’9 ‘9 3 CE i K {3 {:3 'D i 3 Q t E x a i 3 1 {3% {jg g E ‘ ‘ E i * a '3 *9 stLi‘ mam WWW; gxgtlfiggcgfia; "W 3"" 5“ m 3w» ' 3 @gfiw *5» *3 %§ gr Cgrgg a}? $5.013 M QWV‘E $w3¥ g”? gfgwa gkifl Nazi, £§$§A%‘§‘£& . \x: 0 O Q {3 Q a E % Q m W EM; f: 1 T ® \ffl‘iwm a.» £9? M“ g {3; m E “W” W {R fiumyk Wéix : a E 1 1 W9“ m3» QM ; § :43 E g 3 % 5Q Eggxiw 3w ix: :: i 3%; W« W. W §wfs§§§2 Wm ‘\ 3 Sm Mm. Rm‘AL 3mg}; firkgfj‘ AME} \w‘e‘immfl fiwgvfl} mag; ‘ “YMiA‘T-i T5“ "V M“§{ Awfiéf m}; w: :3 10m»? wwmg4 13:93.5 1‘ 85kg vwm a; r “gm Wig.“ 33% {59$wi. ...
View Full Document

This note was uploaded on 04/25/2010 for the course ECSE 221 taught by Professor F.pferrie during the Fall '09 term at McGill.

Page1 / 11

ECSE 221 - Fall 2004 solutions - Egkfi‘” :5 fig...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online