\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{dewey165} \pdfinfo{ /Title (tolvuhogun.pdf) /Creator (Cheatography) /Author (dewey165) /Subject (Tolvuhogun Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A30F0F} \definecolor{LightBackground}{HTML}{F9F0F0} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Tolvuhogun Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{dewey165} via \textcolor{DarkBackground}{\uline{cheatography.com/20059/cs/2926/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}dewey165 \\ \uline{cheatography.com/dewey165} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 25th November, 2014.\\ Updated 13th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{x{1.09856 cm} x{2.33444 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Skel leiðbeiningar}} \tn % Row 0 \SetRowColor{LightBackground} Skel Command & Hvað það gerir: \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} touch & create \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} tar & compression \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} grep pattern files & search for pattern in files \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} rm -r & remove directory \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} tail & output last 10 lines of file \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} xf - cf & extract - create \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} grep -r & search recursively in dir \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} rm & delete file \tn % Row Count 11 (+ 1) % Row 9 \SetRowColor{white} man & Manual, get help \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} info & documentation, replaces man erfiðara að nota \tn % Row Count 14 (+ 2) % Row 11 \SetRowColor{white} pwd & show current working directory \tn % Row Count 16 (+ 2) % Row 12 \SetRowColor{LightBackground} cd & change current directory \tn % Row Count 17 (+ 1) % Row 13 \SetRowColor{white} ls & show lists of files or information \tn % Row Count 19 (+ 2) % Row 14 \SetRowColor{LightBackground} cp & copy file \tn % Row Count 20 (+ 1) % Row 15 \SetRowColor{white} mv & move file or rename it \tn % Row Count 21 (+ 1) % Row 16 \SetRowColor{LightBackground} mkdir & make directory \tn % Row Count 22 (+ 1) % Row 17 \SetRowColor{white} rmdir & delete directory \tn % Row Count 23 (+ 1) % Row 18 \SetRowColor{LightBackground} wc & print byte,word and line counts \tn % Row Count 25 (+ 2) % Row 19 \SetRowColor{white} sort & Sort text files \tn % Row Count 26 (+ 1) % Row 20 \SetRowColor{LightBackground} cat & Send a file to the screen in one go \tn % Row Count 28 (+ 2) % Row 21 \SetRowColor{white} cat *.txt \textgreater{} outfile & add all .txt files together \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.09856 cm} x{2.33444 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Skel leiðbeiningar (cont)}} \tn % Row 22 \SetRowColor{LightBackground} less & Display output one screen at a time \tn % Row Count 2 (+ 2) % Row 23 \SetRowColor{white} head & Output the first part of file \tn % Row Count 4 (+ 2) % Row 24 \SetRowColor{LightBackground} uniq & checking for uniqueness, leita eftir eiginleikum t.d. nafn \tn % Row Count 7 (+ 3) % Row 25 \SetRowColor{white} chmod & change access permissions \tn % Row Count 8 (+ 1) % Row 26 \SetRowColor{LightBackground} cut & Divide a file into several parts \tn % Row Count 10 (+ 2) % Row 27 \SetRowColor{white} more & show a file one screen at a time \tn % Row Count 12 (+ 2) % Row 28 \SetRowColor{LightBackground} ./ & run a file \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.6866 cm} x{2.7464 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Bitwise operator}} \tn % Row 0 \SetRowColor{LightBackground} AND \& & 1001 AND 0101 = 0001 \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} OR | & 1001 OR 0101 = 1101 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} NOT \textasciitilde{} & NOT 1001 = 0110 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} XOR \textasciicircum{} & 1001 XOR 1011 = 0010 \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.54485 cm} x{1.88815 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Precision F10}} \tn % Row 0 \SetRowColor{LightBackground} Single precision 32 bits & 1 s - exp 8bits -frac 23bits \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Double precision 64 bits & 1 s - exp 11bits -frac 52bits \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.12221 cm} x{0.81891 cm} x{1.09188 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Floating point}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Case 1 }} & {\bf{Case 2}} & {\bf{Case 3 }} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{Normalized values}} & {\bf{De-normalized values}} & {\bf{Special values}} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} Exponent field is {\emph{neither}} all-zero nor all-one & Exponent field is {\bf{all-zero}} & sértilfelli deilt með 0 og óendaleikinn \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} {\bf{E = e - bias}} & {\bf{E = 1 - bias}} & Exponent = {\bf{all ones}} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} e is an integer codedon is between 0 - 1 in binary(exp field) & 101 = 5/2\textasciicircum{}3 & Mantissa = {\bf{non-zero}} \tn % Row Count 15 (+ 5) % Row 5 \SetRowColor{white} {\bf{M = 1 + f}} & M = f & {\bf{infinity}} = expo {\emph{all-ones}} Mantissa {\emph{all-zero}} \tn % Row Count 19 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.55293 cm} x{0.84256 cm} p{0.65825 cm} p{0.57926 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{3.833cm}}{\bf\textcolor{white}{Data types}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{C data types}} & {\bf{Assembly equilvalent}} & {\bf{Assembly suffix}} & {\bf{Size in bytes}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} char & byte & b & 1 \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} short & word & w & 2 \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} int & double word & l & 4 \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} char * & double word & l & 4 \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} float & single precision & s & 4 \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} double & double precision & l & 8 \tn % Row Count 11 (+ 2) % Row 7 \SetRowColor{white} long double & Extended precision & t & 10/12 \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.47619 cm} x{1.95681 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{GCC compiler}} \tn % Row 0 \SetRowColor{LightBackground} gcc -O1 -S -m32 -0 sum.s sum.c & source file {\emph{sum.c}}, output file {\emph{sum.s}}, level 1 optimizations, 32 bit assembly code \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Hw3 problem 1}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi a \textasciicircum{}: {\bf{((a \textasciicircum{} b) \& \textasciitilde{}b) | (\textasciitilde{}(a\textasciicircum{}b)\&b)}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{{\bf{(x\&\textasciitilde{}b) | (\textasciitilde{}x\&b)}} = x\textasciicircum{}b // {\emph{x = a\textasciicircum{}b}}} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{(a\textasciicircum{}b) \textasciicircum{} b = a \textasciicircum{} b \textasciicircum{} b = {\bf{a}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi b\textasciicircum{}: {\bf{1 + (a \textless{}\textless{} 3) + \textasciitilde{}a}}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}a + 1 + (a\textless{}\textless{}3)} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{-a + (a\textless{}\textless{}3)} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{-a + 8*a = {\bf{7a}}} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi c\textasciicircum{} : {\bf{\textasciitilde{}(\textasciitilde{}a|(b\textasciicircum{}(MIN\_INT+MAX\_INT)))}}} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}(\textasciitilde{}a |(b \textasciicircum{}{\bf{-1}})) = \textasciitilde{}(\textasciitilde{}a|\textasciitilde{}b) = {\bf{a\&b}}} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi d\textasciicircum{} : {\bf{(a\textless{}\textless{}4) + (a\textless{}\textless{}2) + (a\textless{}\textless{}1)}}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{a*16 + 4*a + 2*a = {\bf{22a}}} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi e\textasciicircum{} : {\bf{a \textasciicircum{} (MIN + MAX)}} // {\emph{(MIN + MAX) = -1}}} \tn % Row Count 13 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{a \textasciicircum{} -1 = {\bf{\textasciitilde{}a}}} \tn % Row Count 14 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi f\textasciicircum{} : {\bf{\textasciitilde{}((a |(\textasciitilde{}a+1)) \textgreater{}\textgreater{} W)\&1}}} \tn % Row Count 15 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{1XXX | 0XXX = 1XXX \textbackslash{}\textbackslash{} 0000 | 0000 = 0000} \tn % Row Count 16 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1XXX \textgreater{}\textgreater{} W == 1111 \textbackslash{}\textbackslash{} 0000 \textgreater{}\textgreater{} W == 0000} \tn % Row Count 17 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}(1 \textgreater{}\textgreater{} W)\&1 \textbackslash{}\textbackslash{} 0 \& 1 = 0\textbackslash{}\textbackslash{} 1 \& 1 = 1\textbackslash{}\textbackslash{} {\bf{(a == 0)}}} \tn % Row Count 19 (+ 2) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi g\textasciicircum{} : {\bf{((a\textless{}0)?(a+3): a)\textgreater{}\textgreater{}2}}} \tn % Row Count 20 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{a / 4 gerir ekki rad fyrir minus tolum} \tn % Row Count 21 (+ 1) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi h\textasciicircum{} : {\bf{\textasciitilde{}((a \textgreater{}\textgreater{} W) \textless{}\textless{} 1)}}} \tn % Row Count 22 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}(sign \textless{}\textless{} 1)} \tn % Row Count 23 (+ 1) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}1111 \textless{}\textless{} 1 // negative} \tn % Row Count 24 (+ 1) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{0001 = 1} \tn % Row Count 25 (+ 1) % Row 23 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciitilde{}0000 \textless{}\textless{} 1 // positive} \tn % Row Count 26 (+ 1) % Row 24 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{1111 = -1} \tn % Row Count 27 (+ 1) % Row 25 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\textasciicircum{}Dæmi i\textasciicircum{}: {\bf{a \textgreater{}\textgreater{} 2}}} \tn % Row Count 28 (+ 1) % Row 26 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{gerdur til ad rugla thvi hann tekur ekki minus tolur} \tn % Row Count 30 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.36485 cm} x{0.87957 cm} p{0.78858 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Problem 2}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Number}} & {\bf{Decimal}} & {\bf{Binary}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Zero & 0 & 00000 \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} n/a & -4 & 11100 \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} n/a & 11 & 01011 \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} n/a & -14 & 10010 \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} n/a & 14 & 01110 \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} n/a & -11 & 10101 \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} TMax & 15 & 01111 \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} TMin & -16 & 10000 \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} TMin + TMin & 0 & 00000 \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} TMin + 1 & -15 & 01111 \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} TMax + 1 & -16 & 10000 \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} -TMax & -15 & 10001 \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} -TMin & -16 & 10000 \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} {\bf{Mínus t{\"o}lur}} & \textasciitilde{}10000 + 1 & 01111 + 1 \tn % Row Count 15 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.60559 cm} p{0.36862 cm} x{0.86889 cm} p{0.7899 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{3.833cm}}{\bf\textcolor{white}{Problem 3}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Description}} & {\emph{Hex}} & {\emph{m}} & {\emph{E}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -0 & 8000 & M = 0/256 & 1 - bias = -62 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} smallest value \textgreater{} 1 & & 256/256 + 1/256 = {\bf{257/256}} & E = e - bias = 0 \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} Largest \seqsplit{Denormalized} & 255*2\textasciicircum{}(-70) & 255/256 & E = 1 - bias(63) = -62 \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} Hex 3AA0 & & m = 1+fraction/2\textasciicircum{}8 & E = e - bias = 58 -63 = -5 \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Problem 6}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{foo: \newline % Row Count 1 (+ 1) pushl \%ebp \newline % Row Count 2 (+ 1) movl \%esp,\%ebp \newline % Row Count 3 (+ 1) movl 8(\%ebp),\%ecx \textbackslash{}\textbackslash{} ecx = *a \newline % Row Count 4 (+ 1) movl 16(\%ebp),\%edx \textbackslash{}\textbackslash{}edx = val \newline % Row Count 5 (+ 1) movl 12(\%ebp),\%eax \textbackslash{}\textbackslash{} eax = n \newline % Row Count 6 (+ 1) decl \%eax \textbackslash{}\textbackslash{} eax = n-1 \newline % Row Count 7 (+ 1) js .L3 \textbackslash{}\textbackslash{} if(n-1 \textless{} 0) goto .L3 \newline % Row Count 9 (+ 2) .L7: \newline % Row Count 10 (+ 1) cmpl \%edx,(\%ecx,\%eax,4) \textbackslash{}\textbackslash{} temp = a{[}i{]} - val \newline % Row Count 12 (+ 2) jne .L3 \textbackslash{}\textbackslash{} if (a{[}i{]} != val) goto .L3 \newline % Row Count 14 (+ 2) decl \%eax \textbackslash{}\textbackslash{} eax = i-1 \newline % Row Count 16 (+ 2) jns .L7 \textbackslash{}\textbackslash{} if(i \textgreater{}= 0) goto .L7 \newline % Row Count 18 (+ 2) .L3: \newline % Row Count 19 (+ 1) movl \%ebp,\%esp \newline % Row Count 20 (+ 1) popl \%ebp \newline % Row Count 21 (+ 1) ret \newline % Row Count 22 (+ 1) int foo(int *a, int n, int val) \{ \newline % Row Count 23 (+ 1) int i; \newline % Row Count 24 (+ 1) for (i = \_{\bf{n-1}}\_\_; \_{\bf{(a{[}i{]} == val) \&\& (i \textgreater{}= 0)}}\_ ; i =\_{\bf{i - 1}}\_) \{ \newline % Row Count 26 (+ 2) ; \newline % Row Count 27 (+ 1) \} \newline % Row Count 28 (+ 1) return i; \newline % Row Count 29 (+ 1) \}% Row Count 30 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{cache}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/dewey165_1416878115_524139_10205362915056755_4792787090790481710_n.jpg}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{HW4 problem 3}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{{\bf{copy\_element:}} \newline % Row Count 1 (+ 1) pushl \%ebp \newline % Row Count 2 (+ 1) movl \%esp,\%ebp \newline % Row Count 3 (+ 1) pushl \%ebx \newline % Row Count 4 (+ 1) movl 8(\%ebp),\%ecx // \%ecx = {\bf{i}} \newline % Row Count 5 (+ 1) movl 12(\%ebp),\%ebx // \%ebx = {\bf{j}} \newline % Row Count 6 (+ 1) movl \%ecx,\%edx // \%edx = {\bf{i}} \newline % Row Count 7 (+ 1) leal (\%ebx,\%ebx,8),\%eax // \%eax = {\bf{8j}} + {\bf{j}} = {\bf{9j}} \newline % Row Count 9 (+ 2) sall \$4,\%edx // \%edx = {\bf{16i}} \newline % Row Count 11 (+ 2) sall \$2,\%eax // \%eax = {\bf{36j}} \newline % Row Count 13 (+ 2) subl \%ecx,\%edx // \%edx = {\bf{16i}} - {\bf{i}} = {\bf{15i}} \newline % Row Count 15 (+ 2) movl mat2(\%eax,\%ecx,4),\%eax // \%eax = mat2 + {\bf{36j}} + 4{\bf{i}} \newline % Row Count 17 (+ 2) sall \$2,\%edx // \%edx = {\bf{60i}} \newline % Row Count 19 (+ 2) movl \%eax,mat1(\%edx,\%ebx,4) // mat1 + {\bf{60i}}+ 4{\bf{j}} = \%eax \newline % Row Count 21 (+ 2) movl -4(\%ebp),\%ebx // \newline % Row Count 22 (+ 1) movl \%ebp,\%esp // \newline % Row Count 23 (+ 1) popl \%ebp \newline % Row Count 24 (+ 1) ret \newline % Row Count 25 (+ 1) int {\bf{mat1{[}M{]}{[}N{]}}} \newline % Row Count 26 (+ 1) int {\bf{mat2{[}N{]}{[}M{]}}} \newline % Row Count 27 (+ 1) {\bf{mat1{[}i{]}{[}j{]} = mat2{[}j{]}{[}i{]}}} \newline % Row Count 28 (+ 1) mat2 =36j = 36 = M \newline % Row Count 29 (+ 1) mat1 = 144 = N% Row Count 30 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}