PI SCM scm_i_new_double_smob (scm_t_bits tc, scm_t_bits,
                                   scm_t_bits, scm_t_bits);


SCM_INLINE SCM scm_new_smob (scm_t_bits tc, scm_t_bits);
SCM_INLINE SCM scm_new_double_smob (scm_t_bits tc, scm_t_bits,
                                    scm_t_bits, scm_t_bits);

#if SCM_CAN_INLINE || defined SCM_INLINE_C_IMPLEMENTING_INLINES
SCM_INLINE_IMPLEMENTATION SCM
scm_new_smob (scm_t_bits tc, scm_t_bits data)
{
  scm_t_bits smobnum = SCM_TC2SMOBNUM (tc);

  if (SCM_UNLIKELY (scm_smobs[smobnum].mark || scm_smobs[smobnum].free))
    return scm_i_new_smob (tc, data);
  else
    return scm_cell (tc, data);
}

SCM_INLINE_IMPLEMENTATION SCM
scm_new_double_smob (scm_t_bits tc, scm_t_bits data1,
                     scm_t_bits data2, scm_t_bits data3)
{
  scm_t_bits smobnum = SCM_TC2SMOBNUM (tc);

  if (SCM_UNLIKELY (scm_smobs[smobnum].mark || scm_smobs[smobnum].free))
    return scm_i_new_double_smob (tc, data1, data2, data3);
  else
    return scm_double_cell (tc, data1, data2, data3);
}
#endif

#define SCM_NEWSMOB(z, tc, data)                \
  z = scm_new_smob ((tc), (scm_t_bits)(data))
#define SCM_RETURN_NEWSMOB(tc, data)            \
  return scm_new_smob ((tc), (scm_t_bits)(data))

#define SCM_NEWSMOB2(z, tc, data1, data2)               \
  z = scm_new_double_smob ((tc), (scm_t_bits)(data1),   \
                           (scm_t_bits)(data2), 0)
#define SCM_RETURN_NEWSMOB2(tc, data1, data2)                   \
  return scm_new_double_smob ((tc), (scm_t_bits)(data1),        \
                              (scm_t_bits)(data2), 0)

#define SCM_NEWSMOB3(z, tc, data1, data2, data3)                        \
  z = scm_new_double_smob ((tc), (scm_t_bits)(data1),                   \
                           (scm_t_bits)(data2), (scm_t_bits)(data3))
#define SCM_RETURN_NEWSMOB3(tc, data1, data2, data3)                    \
  return scm_new_double_smob ((tc), (scm_t_bits)(data1),                \
                              (scm_t_bits)(data2), (scm_t_bits)(data3))

