亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bits.c.bak

?? LINUX下邏輯運算符的應(yīng)用
?? BAK
字號:
/*  * ICS LAB1  * NOTES:NO TEAMWORK ALLOWED AND NO CHEATING!  * bits.c - Source file with your solutions to the Lab. *          This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header - it confuses the dlc * compiler. You can still use printf for debugging without including * <stdio.h>, although you might get a compiler warning. In general, * it's not good practice to ignore compiler warnings, but in this * case it's OK.   */#include "btest.h"#include <limits.h>/* * Instructions to Students: * * STEP 1: Fill in the following struct with your identifying info. */team_struct team ={   /* Replace with your full name */   "陸懿",   /* Replace with your student number*/   "0157085",};#if 0/* * STEP 2: Read the following instructions carefully. */You will provide your solution to the Data Lab byediting the collection of functions in this source file.CODING RULES:   Replace the "return" statement in each function with one  or more lines of C code that implements the function. Your code   must conform to the following style:   int Funct(arg1, arg2, ...) {      /* brief description of how your implementation works */      int var1 = Expr1;      ...      int varM = ExprM;      varJ = ExprJ;      ...      varN = ExprN;      return ExprR;  }  Each "Expr" is an expression using ONLY the following:  1. Integer constants 0 through 255 (0xFF), inclusive. You are      not allowed to use big constants such as 0xffffffff.  2. Function arguments and local variables (no global variables).  3. Unary integer operations ! ~  4. Binary integer operations & ^ | + << >>      Some of the problems restrict the set of allowed operators even further.  Each "Expr" may consist of multiple operators. You are not restricted to  one operator per line.  You are expressly forbidden to:  1. Use any control constructs such as if, do, while, for, switch, etc.  2. Define or use any macros.  3. Define any additional functions in this file.  4. Call any functions.  5. Use any other operations, such as &&, ||, -, or ?:  6. Use any form of casting.   You may assume that your machine:  1. Uses 2s complement, 32-bit representations of integers.  2. Performs right shifts arithmetically.  3. Has unpredictable behavior when shifting an integer by more     than the word size.EXAMPLES OF ACCEPTABLE CODING STYLE:  /*   * pow2plus1 - returns 2^x + 1, where 0 <= x <= 31   */  int pow2plus1(int x) {     /* exploit ability of shifts to compute powers of 2 */     return (1 << x) + 1;  }  /*   * pow2plus4 - returns 2^x + 4, where 0 <= x <= 31   */  int pow2plus4(int x) {     /* exploit ability of shifts to compute powers of 2 */     int result = (1 << x);     result += 4;     return result;  }NOTES:  1. Use the dlc (data lab checker) compiler (described in the handout) to      check the legality of your solutions.  2. Each function has a maximum number of operators (! ~ & ^ | + << >>)     that you are allowed to use for your implementation of the function.      The max operator count is checked by dlc. Note that '=' is not      counted; you may use as many of these as you want without penalty.  3. Use the btest test harness to check your functions for correctness.  4. The maximum number of ops for each function is given in the     header comment for each function. If there are any inconsistencies      between the maximum ops in the writeup and in this file, consider     this file the authoritative source.#endif/* * STEP 3: Modify the following functions according the coding rules. *  *   IMPORTANT. TO AVOID GRADING SURPRISES: *   1. Use the dlc compiler to check that your solutions conform *      to the coding rules. *   2. Use the btest test harness to check that your solutions produce  *      the correct answers. Watch out for corner cases around Tmin and Tmax. *////////////////////////////////////////////////////////////////////////////////// PART I ///////////////////////////////////////////////////////////////////////////////// Duplicate the behavior of the bit operation &.// Example: bitAnd(6, 5) = 4// Legal ops: ~ |// Max ops: 8// Rating: 1int bitAnd(int x, int y) {	return ~((~x)|(~y));}// Duplicate the behavior of the bit operation |.// Example: bitOr(6, 5) = 7// Legal ops: ~ &// Max ops: 8// Rating: 1int bitOr(int x, int y) {	return ~((~x)&(~y));}// Compares x to y, i.e. x==y. It should return 1 if the tested condition // holds and 0 otherwise.// Examples: isEqual(5,5) = 1, isEqual(4,5) = 0// Legal ops: ! ~ & ^ | + <<>> // Max ops: 5// Rating: 2int isEqual(int x, int y) {	return !(x^y);}// Does a logical right shift of x to the right by n.// Can assume that 1 <= n <= 31// Examples: logicalShift(0x87654321,4) = 0x08765432// Legal ops: ~ & ^ | + << >>// Max ops: 16// Rating: 3 int logicalShift(int x, int n) {	return (x>>n)&(~((1<<31)>>n<<1));//(~((1<<31)>>(n+(~1+1))));}// Returns 1 if x contains an odd number of 1's, and 0 otherwise.// Examples: bitParity(5) = 0, bitParity(7) = 1// Legal ops: ! ~ & ^ | + <<>> // Max ops: 20// Rating: 4int bitParity(int x){	x=x^(x>>16);
	x=x^(x>>8);
	x=x^(x>>4);
	x=x^(x>>2);
	x=x^(x>>1);
	return x&1;}// Returns a mask that marks the position of the least significant 1 bit of x// with a 1. All other positions of the mask should be 0.// Example: leastBitPos(96) = 0x20// Legal ops: ! ~ & ^ | + << >>// Max ops: 30// Rating: 4 int leastBitPos(int x) {	return x&(~x+1);}// Returns a count of the number of 1's in the argument.// Examples: bitCount(5) = 2, bitCount(7) = 3// Legal ops: ! ~ & ^ | + << >>// Max ops: 40// Rating: 4int bitCount(int x) {	int m1=(0xFF<<8)+0xFF;//00000000 00000000 11111111 11111111
	int m2=(m1<<8)^m1;  //00000000 11111111 00000000 11111111
	int m3=(m2<<4)^m2;  //00001111 00001111 00001111 00001111
	int m4=(m3<<2)^m3;  //00110011 00110011 00110011 00110011
	int m5=(m4<<1)^m4;  //01010101 01010101 01010101 01010101 
	x=(x&m5)+((x>>1)&m5);
	x=(x&m4)+((x>>2)&m4);
	x=(x&m3)+((x>>4)&m3);
	x=(x&m2)+((x>>8)&m2);
	x=(x&m1)+((x>>16)&m1);
	return x;}// Compute !x without using ! operator.// Examples: bang(3) = 0, bang(0) = 1// Legal ops: ~ & ^ | + << >>// Max ops: 12// Rating: 4 int bang(int x) {	return ((x|(~x+1))>>31)+1;}///////////////////////////////////////////////////////////////////////////////// PART II ///////////////////////////////////////////////////////////////////////////////// Return maximum two's complement integer // Legal ops: ! ~ & ^ | + << >>// Max ops: 4// Rating: 1int tmax(void) {	return ~(1<<31);}// Compute -x without using - operator.// Example: negate(1) = -1.// Legal ops: ! ~ & ^ | + << >> // Max ops: 5// Rating: 2int negate(int x) {	return ~x+1;}// Determines whether argument y can be added to argument x without overflow.// Example: addOK(0x80000000,0x80000000) = 0, addOK(0x80000000,0x70000000) = 1 // Legal ops: ! ~ & ^ | + << >> // Max ops: 20// Rating: 3int addOK(int x, int y) {	int z=x+y;
	return !(((z^x)&(z^y))>>31);}// Check whether x is nonzero using the legal operators except !// Examples: isNonZero(3) = 1, isNonZero(0) = 0// Legal ops: ~ & ^ | + << >>// Max ops: 10// Rating: 4 int isNonZero(int x){	return (~((x|(~x+1))>>31))+1;}// Converts a number from sign-magnitude format to two抯 complement format. // That is, the high order bit of x is a sign bit s, while the remaining bits // denote a nonnegative magnitude m. The function should then return the // two抯 complement representation of (-1)^s*m.// Example: sm2tc(0x80000005) = -5.// Legal ops: ! ~ & ^ | + << >>// Max ops: 15// Rating: 4int sm2tc(int x) {	int s=x>>31;
	int m=(~(1<<31))&x;
	return (m^s)+(1&s);}// Compute absolute value of x. (Except it returns TMin for TMin)// Example: abs(-1) = 1.// Legal ops: ! ~ & ^ | + << >>// Max ops: 10// Rating: 4int abs(int x) {	int t=x>>31;	return (x^t)+(1&t);}// Adds two values and if the result (x+y) has a positive overflow it returns// the greatest possible positive value (instead of getting a negative result). // If the result has a negative overflow, then it should return the least // possible negative value.// Examples: satAdd(0x40000000,0x40000000) = 0x7fffffff//           satAdd(0x80000000,0xffffffff) = 0x80000000// Legal ops: ! ~ & ^ | + << >>// Max ops: 30// Rating: 4int satAdd(int x, int y) {	int z=x+y;
	int flow=((z^x)&(z^y))>>31;	return ((~flow)&z)|(flow&((1<<31)^(z>>31)));}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一级女性全黄久久生活片免费| 亚洲最大的成人av| 3atv一区二区三区| 欧美午夜电影网| 91电影在线观看| 色综合久久99| 日本韩国欧美国产| 欧洲精品一区二区| 日本道在线观看一区二区| 91同城在线观看| 不卡高清视频专区| 91电影在线观看| 欧美三级午夜理伦三级中视频| 欧美日韩亚洲国产综合| 欧美日韩一区在线观看| 欧美精品乱码久久久久久| 69久久99精品久久久久婷婷| 91精品国产免费| 精品久久久久久久久久久久久久久 | 国产成人免费在线| 国产高清一区日本| 色综合一区二区| 欧美亚州韩日在线看免费版国语版| 在线视频国内一区二区| 欧美日韩一区二区三区四区五区| 欧美久久久久中文字幕| 欧美成人女星排名| 国产精品丝袜一区| 亚洲综合色婷婷| 日韩国产欧美三级| 韩日欧美一区二区三区| 高清国产午夜精品久久久久久| 91在线免费视频观看| 欧美日韩一二三| 精品理论电影在线观看 | 欧美一区午夜视频在线观看| 精品国产一区久久| 国产精品久久久久久久第一福利| 亚洲美女免费在线| 久久精品噜噜噜成人av农村| 国产激情一区二区三区桃花岛亚洲| 99综合影院在线| 91精品国产一区二区三区蜜臀| 国产日韩一级二级三级| 亚洲一区二区av在线| 激情深爱一区二区| 欧美在线免费观看视频| 久久夜色精品一区| 午夜精品一区二区三区电影天堂| 国产成人精品在线看| 欧美精品自拍偷拍动漫精品| 欧美sm极限捆绑bd| 亚洲国产精品久久人人爱| 精品综合免费视频观看| 欧美亚洲愉拍一区二区| 国产欧美一区二区三区在线看蜜臀| 亚洲一二三区在线观看| 国产精品亚洲成人| 在线电影欧美成精品| 亚洲国产精品ⅴa在线观看| 五月天网站亚洲| 91伊人久久大香线蕉| 精品对白一区国产伦| 亚洲成在线观看| 波多野结衣视频一区| 精品久久久久久久久久久久包黑料| 亚洲综合在线电影| 国产精一品亚洲二区在线视频| 色又黄又爽网站www久久| 中文子幕无线码一区tr | 中文字幕欧美日韩一区| 久久精品国产99| 欧美一区二区在线播放| 一区二区三区在线观看欧美| thepron国产精品| 国产亚洲精品资源在线26u| 男女性色大片免费观看一区二区| 在线亚洲一区二区| 亚洲同性同志一二三专区| 成人中文字幕电影| 国产欧美一区二区精品婷婷| 国产一区欧美二区| 欧美精品一区二区三区久久久| 日韩和欧美一区二区| 欧美精品在线视频| 日韩精品91亚洲二区在线观看 | 久久久久久久久久久电影| 久久99这里只有精品| 精品国产乱码91久久久久久网站| 免费成人深夜小野草| 欧美变态口味重另类| 久久99九九99精品| 久久精品日产第一区二区三区高清版| 激情综合色综合久久综合| 亚洲精品一区二区三区香蕉| 九九国产精品视频| 欧美激情一区二区三区四区| 成人免费va视频| 一区二区三区小说| 3d动漫精品啪啪1区2区免费| 国产麻豆日韩欧美久久| 中文字幕av一区二区三区高| 色婷婷狠狠综合| 天天综合天天综合色| 日韩女同互慰一区二区| 国产精品77777| 中文字幕五月欧美| 精品久久久久久久久久久久久久久久久 | 99免费精品视频| 成人午夜激情片| 日韩一区二区视频| 日韩一区中文字幕| 日本麻豆一区二区三区视频| 日韩毛片一二三区| 成人av免费观看| 亚洲成人资源网| 国产日韩欧美精品综合| 99久久伊人精品| 蜜乳av一区二区三区| 国产精品国产三级国产有无不卡 | 在线免费观看不卡av| 久久不见久久见中文字幕免费| 亚洲国产成人一区二区三区| 7777精品久久久大香线蕉 | 91在线国产观看| 蜜桃视频一区二区三区在线观看| 国产精品蜜臀在线观看| 欧美一区二区黄色| 99久久久无码国产精品| 狠狠久久亚洲欧美| 亚洲a一区二区| 国产精品乱码一区二区三区软件| 欧美一区二区三区播放老司机| 99久久99久久久精品齐齐| 另类中文字幕网| 丝袜诱惑制服诱惑色一区在线观看 | 伦理电影国产精品| 亚洲成人激情自拍| 中文字幕第一区第二区| 日韩美女主播在线视频一区二区三区| 色婷婷综合久色| 成人av网站免费| 成人性生交大片免费看视频在线| 久久国产精品99精品国产| 亚洲成a人v欧美综合天堂下载 | 日韩影院在线观看| 夜夜爽夜夜爽精品视频| 亚洲欧美日韩电影| 亚洲图片激情小说| 亚洲男人的天堂av| 亚洲激情网站免费观看| 91亚洲大成网污www| 国产福利电影一区二区三区| 乱中年女人伦av一区二区| 美国av一区二区| 九九九久久久精品| 国产麻豆精品95视频| 国产一区二区三区综合| 国产一区二区0| 国产一区二区在线影院| 国产精品一区二区你懂的| 精品亚洲porn| 精品亚洲porn| 三级久久三级久久久| 天使萌一区二区三区免费观看| 中文字幕一区二区三区在线不卡| 中文字幕在线免费不卡| 国产午夜精品一区二区三区视频 | 日韩女优视频免费观看| 日韩美女啊v在线免费观看| 精品国偷自产国产一区| 91精品国产91久久综合桃花| 在线视频一区二区三区| 日本韩国精品在线| 国产69精品久久久久毛片| 91免费版在线| 欧美日韩美少妇| 欧美成人在线直播| 亚洲欧洲国产专区| 欧美大尺度电影在线| 成人免费va视频| 麻豆精品一二三| 成人一二三区视频| 国产91高潮流白浆在线麻豆| 国产福利一区在线| 91激情五月电影| 欧美日本一区二区| 91精品国产色综合久久久蜜香臀| 欧美日韩亚洲高清一区二区| 精品成人一区二区三区| 久久精品网站免费观看| 国产精品久99| 秋霞av亚洲一区二区三| 国精产品一区一区三区mba视频 | 日韩一区精品视频| 日本伊人午夜精品| 国产福利一区二区三区| 色欧美片视频在线观看在线视频| 欧美日韩亚洲综合一区二区三区| www亚洲一区|