datalab-handout/bits.h /* Copyright (C XXXXXXXXXXFree Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it...

1 answer below ยป
I need help with this assignment


datalab-handout/bits.h /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see. */ /* This header is separate from features.h so that the compiler can include it implicitly at the start of every compilation. It must not itself include or any other header that includes because the implicit include comes before any feature test macros that may be defined in a source file before it first explicitly includes a system header. GCC knows the name of this header in order to preinclude it. */ /* glibc's intent is to support the IEC 559 math functionality, real and complex. If the GCC (4.9 and later) predefined macros specifying compiler intent are available, use them to determine whether the overall intent is to support these features; otherwise, presume an older compiler has intent to support these features and define these macros by default. */ /* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is synchronized with ISO/IEC 10646:2017, fifth edition, plus the following additions from Amendment 1 to the fifth edition: - 56 emoji characters - 285 hentaigana - 3 additional Zanabazar Square characters */ /* We do not support C11 . */ /*************************************************** * BOOLEAN operations (8 puzzles, 18 points total) * ***************************************************/ int bitOr(int, int); int test_bitOr(int, int); int bitAnd(int, int); int test_bitAnd(int, int); int bitXor(int, int); int test_bitXor(int, int); int isNotEqual(int, int); int test_isNotEqual(int, int); int copyLSB(int); int test_copyLSB(int); int specialBits(); int test_specialBits(); int conditional(int, int, int); int test_conditional(int, int, int); int bitParity(int); int test_bitParity(int); /******************************************* * INTEGERS (8 puzzles, 22 points total) * *******************************************/ int minusOne(); int test_minusOne(); int tmax(); int test_tmax(); int negate(int); int test_negate(int); int isNegative(int); int test_isNegative(int); int isPositive(int); int test_isPositive(int); int bang(int); int test_bang(int); int addOK(int, int); int test_addOK(int, int); int absVal(int); int test_absVal(int); /************************************************************* * BONUS puzzles BELOW! be advised, some are quite difficult * ************************************************************/ /*************************************************** INTEGERS and BOOLEAN (3 puzzles, up to 10 points) * ***************************************************/ int byteSwap(int, int, int); int test_byteSwap(int, int, int); int bitCount(int); int test_bitCount(int); int logicalShift(int, int); int test_logicalShift(int, int); datalab-handout/Driverhdrs.pm # # This file contains configuration variables for drivers. # It was generated by genhdrs.pl. Do not modify it. # package Driverhdrs; $LAB = "datalab"; $SERVER_NAME = "2467.cs.uno.edu"; $SERVER_PORT = 8081; $COURSE_NAME = "csapp"; $AUTOGRADE_TIMEOUT = 0; 1; datalab-handout/README *********************** The CS:APP Data Lab Directions to Students *********************** Your goal is to modify your copy of bits.c so that it passes all the tests in btest without violating any of the coding guidelines. ********* 0. Files: ********* Makefile- Makes btest, fshow, and ishow README- This file bits.c- The file you will be modifying and handing in bits.h- Header file btest.c- The main btest program btest.h- Used to build btest decl.c- Used to build btest tests.c - Used to build btest tests-header.c- Used to build btest dlc*- Rule checking compiler binary (data lab compiler) driver.pl*- Driver program that uses btest and dlc to autograde bits.c Driverhdrs.pm - Header file for optional "Beat the Prof" contest fshow.c- Utility for examining floating-point representations ishow.c- Utility for examining integer representations *********************************************************** 1. Modifying bits.c and checking it for compliance with dlc *********************************************************** IMPORTANT: Carefully read the instructions in the bits.c file before you start. These give the coding rules that you will need to follow if you want credit for your work. Use the dlc compiler (./dlc) to automatically check your version of bits.c for compliance with the coding guidelines: unix> ./dlc bits.c dlc returns silently if there are no problems with your code. Otherwise it prints messages that flag any problems. Running dlc with the -e switch: unix> ./dlc -e bits.c causes dlc to print counts of the number of operators used by each function. Once you have a legal solution, you can test it for correctness using the ./btest program. ********************* 2. Testing with btest ********************* The Makefile in this directory compiles your version of bits.c with additional code to create a program (or test harness) named btest. To compile and run the btest program, type: unix> make btest unix> ./btest [optional cmd line args] You will need to recompile btest each time you change your bits.c program. When moving from one platform to another, you will want to get rid of the old version of btest and generate a new one. Use the commands: unix> make clean unix> make btest Btest tests your code for correctness by running millions of test cases on each function. It tests wide swaths around well known corner cases such as Tmin and zero for integer puzzles, and zero, inf, and the boundary between denormalized and normalized numbers for floating point puzzles. When btest detects an error in one of your functions, it prints out the test that failed, the incorrect result, and the expected result, and then terminates the testing for that function. Here are the command line options for btest: unix> ./btest -h Usage: ./btest [-hg] [-r ] [-f [-1|-2|-3 ]*] [-T
Answered 4 days AfterOct 02, 2021

Answer To: datalab-handout/bits.h /* Copyright (C XXXXXXXXXXFree Software Foundation, Inc. This file is part of...

Karthi answered on Oct 04 2021
121 Votes
76_cpp_92464/bits.h
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
. */
/* This header is separate from features.h so that the compiler can
include it implicitly at the start of every compilation. It must
not itself include or any other header that includes
because the implicit include comes before any feature
test macros that may be defined in a source file before it first
explicitly includes a system header. GCC knows the name of this
header in order to preinclude it. */
/* glibc's intent is to support the IEC 559 math functionality, real
and complex. If the GCC (4.9 and later) predefined macros
specifying compiler intent are available, use them to determine
whether the overall intent is to support these features; otherwise,
presume an older compiler has intent to support these features and
define these macros by default. */
/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is
synchronized with ISO/IEC 10646:2017, fifth edition, plus
the following additions from Amendment 1 to the fifth edition:
- 56 emoji characters
- 285 hentaigana
- 3 additional Zanabazar Square characters */
/* We do not support C11 . */
/***************************************************
* BOOLEAN operations (8 puzzles, 18 points total) *
***************************************************/
int bitOr(int, int);
int test_bitOr(int, int);
int bitAnd(int, int);
int test_bitAnd(int, int);
int bitXor(int, int);
int test_bitXor(int, int);
int isNotEqual(int, int);
int test_isNotEqual(int, int);
int copyLSB(int);
int test_copyLSB(int);
int specialBits();
int test_specialBits();
int conditional(int, int, int);
int test_conditional(int, int, int);
int bitParity(int);
int test_bitParity(int);
/*******************************************
* INTEGERS (8 puzzles, 22 points total) *
*******************************************/
int minusOne();
int test_minusOne();
int tmax();
int test_tmax();
int negate(int);
int test_negate(int);
int isNegative(int);
int test_isNegative(int);
int isPositive(int);
int test_isPositive(int);
int bang(int);
int test_bang(int);
int addOK(int, int);
int test_addOK(int, int);
int absVal(int);
int test_absVal(int);
/*************************************************************
* BONUS puzzles BELOW! be advised, some are quite difficult *
************************************************************/
/***************************************************
INTEGERS and BOOLEAN (3 puzzles, up to 10 points) *
***************************************************/
int byteSwap(int, int, int);
int test_byteSwap(int, int, int);
int bitCount(int);
int test_bitCount(int);
int logicalShift(int, int);
int test_logicalShift(int, int);
76_cpp_92464/Driverhdrs.pm
#
# This file contains configuration variables for drivers.
# It was generated by genhdrs.pl. Do not modify it.
#
package Driverhdrs;
$LAB = "datalab";
$SERVER_NAME = "2467.cs.uno.edu";
$SERVER_PORT = 8081;
$COURSE_NAME = "csapp";
$AUTOGRADE_TIMEOUT = 0;
1;
76_cpp_92464/README
***********************
The CS:APP Data Lab
Directions to Students
***********************
Your goal is to modify your copy of bits.c so that it passes all the
tests in btest without violating any of the coding guidelines.
*********
0. Files:
*********
Makefile    - Makes btest, fshow, and ishow
README        - This file
bits.c        - The file you will be modifying and handing in
bits.h        - Header file
btest.c        - The main btest program
btest.h    - Used to build btest
decl.c    - Used to build btest
tests.c - Used to build btest
tests-header.c- Used to build btest
dlc*        - Rule checking compiler binary (data lab compiler)    
driver.pl*    - Driver program that uses btest and dlc to autograde bits.c
Driverhdrs.pm - Header file for optional "Beat the Prof" contest
fshow.c        - Utility for examining floating-point represen
tations
ishow.c        - Utility for examining integer representations
***********************************************************
1. Modifying bits.c and checking it for compliance with dlc
***********************************************************
IMPORTANT: Carefully read the instructions in the bits.c file before
you start. These give the coding rules that you will need to follow if
you want credit for your work.
Use the dlc compiler (./dlc) to automatically check your version of
bits.c for compliance with the coding guidelines:
unix> ./dlc bits.c
dlc returns silently if there are no problems with your code.
Otherwise it prints messages that flag any problems. Running dlc with
the -e switch:
    unix> ./dlc -e bits.c
causes dlc to print counts of the number of operators used by each function.
Once you have a legal solution, you can test it for correctness using
the ./btest program.
*********************
2. Testing with btest
*********************
The Makefile in this directory compiles your version of bits.c with
additional code to create a program (or test harness) named btest.
To compile and run the btest program, type:
unix> make btest
unix> ./btest [optional cmd line args]
You will need to recompile btest each time you change your bits.c
program. When moving from one platform to another, you will want to
get rid of the old version of btest and generate a new one. Use the
commands:
unix> make clean
unix> make btest
Btest tests your code for correctness by running millions of test
cases on each function. It tests wide swaths around well known corner
cases such as Tmin and zero for integer puzzles, and zero, inf, and
the boundary between denormalized and normalized numbers for floating
point puzzles. When btest detects an error in one of your functions,
it prints out the test that failed, the incorrect result, and the
expected result, and then terminates the testing for that function.
Here are the command line options for btest:
unix> ./btest -h
Usage: ./btest [-hg] [-r ] [-f [-1|-2|-3 ]*] [-T
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here