docstr: Check size of a given type.
docstr_tok: ["Check","size","of","a","given","type","."]
code: def check_type_size(
      self,
      type_name,
      headers=None,
      include_dirs=None,
      library_dirs=None,
      expected=None,
  ):
      """Check size of a given type."""
      self._check_compiler()
  
      # First check the type can be compiled
      body = textwrap.dedent(
          r"""
              typedef %(type)s npy_check_sizeof_type;
              int main (void)
              {
                  static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) >= 0)];
                  test_array [0] = 0
  
                  ;
                  return 0;
              }
              """
      )
      self._compile(
          body % {"type": type_name}, headers, include_dirs, "c"
      )
      self._clean()
  
      if expected:
          body = textwrap.dedent(
              r"""
                  typedef %(type)s npy_check_sizeof_type;
                  int main (void)
                  {
                      static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) == %(size)s)];
                      test_array [0] = 0
  
                      ;
                      return 0;
                  }
                  """
          )
          for size in expected:
              try:
                  self._compile(
                      body % {"type": type_name, "size": size},
                      headers,
                      include_dirs,
                      "c",
                  )
                  self._clean()
                  return size
              except CompileError:
                  pass
  
      # this fails to *compile* if size > sizeof(type)
      body = textwrap.dedent(
          r"""
              typedef %(type)s npy_check_sizeof_type;
              int main (void)
              {
                  static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) <= %(size)s)];
                  test_array [0] = 0
  
                  ;
                  return 0;
              }
              """
      )
  
      # The principle is simple: we first find low and high bounds of size
      # for the type, where low/high are looked up on a log scale. Then, we
      # do a binary search to find the exact size between low and high
      low = 0
      mid = 0
      while True:
          try:
              self._compile(
                  body % {"type": type_name, "size": mid},
                  headers,
                  include_dirs,
                  "c",
              )
              self._clean()
              break
          except CompileError:
              # log.info("failure to test for bound %d" % mid)
              low = mid + 1
              mid = 2 * mid + 1
  
      high = mid
      # Binary search:
      while low != high:
          mid = (high - low) // 2 + low
          try:
              self._compile(
                  body % {"type": type_name, "size": mid},
                  headers,
                  include_dirs,
                  "c",
              )
              self._clean()
              high = mid
          except CompileError:
              low = mid + 1
      return low
  
imports: import os
  import signal
  import subprocess
  import sys
  import textwrap
  import warnings
  from distutils.command.config import config
  from distutils.command.config import LANG_EXT
  from distutils import log
  from distutils.file_util import copy_file
  from distutils.ccompiler import CompileError, LinkError
  import distutils
  from numpy.distutils.exec_command import filepath_from_subprocess_output
  from numpy.distutils.mingw32ccompiler import generate_manifest
  from numpy.distutils.command.autodist import check_gcc_function_attribute, check_gcc_function_attribute_with_intrinsics, check_gcc_variable_attribute, check_gcc_version_at_least, check_inline, check_restrict, check_compiler_gcc
label_desc: Use image node_id 10 for calling the config obj's underlying member method code with example usage: obj.check_type_size(type_name, headers, include_dirs, library_dirs, expected) and returns: low, size