title: Cast char to a bit field entry of 4 bits
body: <p>Hello guys I'm facing another problem, I'm working on single bits and extract data from ascii text. The problem is that the compiler gives me an error about the fact that casting a char (8 bits) to a 4 bit memory field may alter its value.</p>
  
  <p>Obviously that's true but how could I overcome that error?</p>
  
  <pre><code>typedef struct {
  struct {
      unsigned int type:        4;
      unsigned int uid:         8;
      unsigned int operation:   4; 
      unsigned int reg:         16;
  }header;
  char *arg_nm;
  } OWL_request;
  </code></pre>
  
  <p>The complete error:</p>
  
  <pre><code> error: conversion to 'unsigned char:4' from 'char' may alter its value [-Werror=conversion]
  </code></pre>
  
  <p>and this is the assignment</p>
  
  <pre><code>request.header.type = (char)(j[0]-65);
  </code></pre>
  
  <p><code>j</code> is <code>*char</code></p>
  
  <p>What I have to do is to get rid of the error without altering compiler flags</p>